user8244016 user8244016 - 5 months ago 33
Ajax Question

JavaScript - How does AJAX data request appear in the url?

when sending

request from client side to server side (if I'm not wrong) we often send data like this :

var postData={name: John, psd: 123 , description : "student"};
var xhttp = new XMLHttpRequest();"POST","http://localhost:8080/user", false);
xhttp.setRequestHeader("Content-type", "application/json-application");

I'm not sure how does the sent data
appear in the url to the server. I'll be glad if someone can help me or guide me to some materials or articles.

Answer Source

I guess your confusion is related to a misconception about POST requests. POST requests can post data to servers. This data (thankfully) does not have to be in the url as query string. Indeed, that's how web gets secured by HTTPS. So data could be sent to a server in a POST request in two separate ways: query string and post data. I hope that helps.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download