Reputation: 11577
There're two GET requests:
1) "usual"GET (involves reloading page).
2) ajax GET (sync, async) background request.
What is difference between them?? Does HTTP standard make a distinction bitween them??
Upvotes: 0
Views: 426
Reputation: 1075755
No, the HTTP standard makes no distinction between them. The distinction is applied at the browser level.
Fundamentally, the big difference is that a request via XMLHttpRequest
(an "ajax" request) is subject to the Same Origin Policy. A normal GET
is not. This means that in the normal case, you can't use a genuine "ajax" request to retrieve a resource from a different "origin" than the page on which your script is running. (Note that it's the origin of the page on which your script is running, not the origin of your script file, which can be from anywhere.)
There are ways in which "ajax" can be used even cross-origin:
XDomainRequest
object rather than XMLHttpRequest
.script
element. (The script in question is usually dynamically generated, and its sole job is to deliver a JavaScript object as a payload by calling a function.)Upvotes: 1
Reputation: 116190
No. There is no difference. Although some browsers, and some frameworks like jQuery send an additional header, so you can make a distinction if you like. Otherwise they are handled the same.
Upvotes: 2