|Getting Started With jQuery - Advanced Ajax|
|Written by Ian Elliot|
|Thursday, 04 November 2021|
Page 1 of 5
So far in our exploration of jQuery we have used the "shorthand" Ajax methods. These are all implemented as calls the to the full jQuery ajax method and if you want to do anything slightly out of the ordinary then you need to make use of it directly. In this installment we look at controlling the request and sending data to the server
Available as a Book:
Buy from Amazon.
Events, Async & AJAX
buy from Amazon
Raw ajax method
The raw or low level ajax method is very easy to specify. You can call it either using:
or just as
with the url specified as part of the options object.
All of the complexities of using it are hidden in the options object. This is a set of key value pairs that you use to specify how the Ajax request should be performed.
Notice that the only difference between the two forms of using the ajax method is that if you don't specify the url as the first parameter it has to be specified in the option object.
The simplest post request using the ajax method is something like:
That is the url property sets the request url, the method sets the method to post in this case and the data property is the data sent to the server.
This is all there is the the ajax method and all that remains to do is investigate the various options you can set.
Instead of dealing with the option in alphabetical order, which is what the documentation does, it is more useful to look at them in groups according to what they are concerned with.
Controlling the request
There are a set of options that modify the very basic nature of the Ajax request. Instead of just presenting them as an alphabetic list it is worth dealing with the in logical groups.
You need to read the first section on controlling the basic HTTP call.
Basic HTTP call
There are a set of options that control the basic nature of the HTTP request being made and how it is handled.
It is important that you read the section on ifModified and cache.
|Last Updated ( Thursday, 04 November 2021 )|