Cover by Marijn Haverbeke

Safari, the world’s most comprehensive technology and business learning platform.

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required

O'Reilly logo

The XMLHttpRequest API

When you click a link, submit a form, or in some other way encourage your browser to go to a new page, it will make an HTTP request and, if successful, show the newly loaded document. In typical situations, this is just what you want—it is how the Web traditionally works. Sometimes, however, a JavaScript program wants to communicate with the server without reloading the page.

To be able to do something like that, the program must make the HTTP request itself. Contemporary browsers provide an interface for doing this. As with opening new windows, this interface is subject to some restrictions—to prevent a script from doing anything scary, it is allowed to make HTTP requests only to the domain that the current page came from, ...

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required