[英]How can I use Ajax with node.js with out using jQuery
我一直在嘗試將 ajax 與node.js
一起使用,但就像我的服務器端節點不存在一樣。
<script>
testmessage = () => {
xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET","../index.js", true);
xmlhttp.send();
}
</script>
這會引發以下錯誤:
找不到 index.js
我使用express
和ejs
在本地托管站點
我的 index.js 文件是上面的一個目錄
我只需要將請求發送到localhost:3000
因為它是服務器,而不是它下面的某個文件。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.