O'Reilly logo

iPhone JavaScript Cookbook by Arturo Fernandez Montoro

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How to send HTTP requests

In this recipe, you'll learn one of the most important issues of AJAX: how to send an HTTP request from the client to the server. Our client will be a simple HTML page with a button. When the user clicks on the button, we'll make a HTTP request to the server. After the request is sent, we'll display a simple message box. In order to keep our recipe as simple as possible, we're going to imagine that we have a backend - the server side - ready to respond to our request. Later in this chapter, you'll learn how to receive and process the client-side response offered by the server.

Using AJAX, we can make requests to the server over HTTP. This network protocol offers different methods such as GET, POST, PUT, and DELETE. Typically, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required