Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

2
  • thank for you answer. If I use ajax request, how can I pass the data to the server.js? I tried this: function loadDoc() { var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { document.getElementById("demo").innerHTML = "ffff"; }; xhttp.open("GET", "server.js", true); xhttp.send(); } but the server.js didnt get the data. I have to do new request in the server file? Or the get request in the server file include all the data and will get back from AJAX the id? Commented May 30, 2018 at 9:10
  • You must have an server to receive your data. Seems like you are using Express as your http server. So you must run something like "node server.js", also you must have an HTTP endpoint like "/task/1" to submit your ajax... xhttp.open("GET", "/task/" + TASKID, true); I strongly recommend you to follow some "getting start" guide like this Commented May 30, 2018 at 22:37