O'Reilly logo

jQuery and JavaScript Phrasebook by Brad Dayley

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

Implementing Low-Level AJAX Requests

$.ajax({   url:"setEmail",   type:"get",   accepts:"json",   contentType: 'application/x-www-form-urlencoded; charset=UTF-8',   data: {"first":"Brad", "last":"Dayley"} }).fail(function(){ alert("request Failed"); });

All AJAX request wrapper methods that you have been working with in his chapter are handled underneath through the .ajax(url [, settings]) interface. This interface is a bit more difficult to use, but it gives you much more flexibility and control of the AJAX request.

The .ajax() method is called the same way that .get() and .post() are, but the settings argument allows you to set a wide variety of settings when making the request.

Table 13.3 lists the more common ...

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