When using jQuery, when sending an Ajax request you specify the URL to send to. For example:
$.get("someurl", function(data) {
console.log(data);
});
My question is: should the URL reference a page on the server, as if the client-page is located on the server? E.g. something like mypage/something? Or should the URL reference the page as if it's on another computer, using a hardcoded host-address, such as http://ift.tt/1yTimlk?
It seems both approaches work. If so, than how does the client-browser know where to send the request if I only specify a file name, and not a full IP address?
Aucun commentaire:
Enregistrer un commentaire