I've been trying to use ajax with node.js
, but it's like my server side node doesn't exist.
<script>
testmessage = () => {
xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET","../index.js", true);
xmlhttp.send();
}
</script>
This throws the following error:
index.js not found
I'm hosting the site locally using express
and ejs
My index.js file is a directory above
我只需要将请求发送到localhost:3000
因为它是服务器,而不是它下面的某个文件。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.