簡體   English   中英

如何在不使用 jQuery 的情況下將 Ajax 與 node.js 一起使用

[英]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

我使用expressejs在本地托管站點
我的 index.js 文件是上面的一個目錄

我只需要將請求發送到localhost:3000因為它是服務器,而不是它下面的某個文件。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM