JavaScript Wiki


87pages on
this wiki
Add New Page
Talk0 Share
This article is a stub. You can help the JavaScript Wiki by expanding it.

"AJAX" is a popular buzzword. Standing for "Asynchronous Javascript And XML", it is often used to mean any form of interaction with the server between page loads, regardless of whether or not asynchrony or XML are actually involved. In technical forums, it is usually preferred to refer to it based upon the actual technology being used. Nowadays, this is generally the XMLHttpRequest object, often abbreviated to "XHR".

Note the license for code on this page. Here's a simple usage of an XMLHttpRequest object, to get the contents of a page on your server:
var xhr = new XMLHttpRequest();'GET', 'some.php', true);
xhr.onreadystatechange = function(){
This code alerts the empty string, then the contents of the page, then the contents of the page again. To understand why, let's change it a bit:
var xhr = new XMLHttpRequest();'GET', 'some.php', true);
xhr.onreadystatechange = function(){


This file is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This work is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

External linksEdit

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.