[英]How can I use Ajax with node.js with out using jQuery
I've been trying to use ajax with node.js
, but it's like my server side node doesn't exist.我一直在尝试将 ajax 与
node.js
一起使用,但就像我的服务器端节点不存在一样。
<script>
testmessage = () => {
xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET","../index.js", true);
xmlhttp.send();
}
</script>
This throws the following error:这会引发以下错误:
index.js not found
找不到 index.js
I'm hosting the site locally using express
and ejs
我使用
express
和ejs
在本地托管站点
My index.js file is a directory above我的 index.js 文件是上面的一个目录
我只需要将请求发送到localhost:3000
因为它是服务器,而不是它下面的某个文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.