« Back to Ajax
A GET request will be performed by default - but if you pass in any extra parameters in the form of an Object/Map (key/value pairs) then a POST will occur. Extra parameters passed as a string will still use a GET request.
Note: Keep in mind that Internet Explorer caches the loaded file, so you should pass some extra random GET parameter to prevent caching if you plan to call this function more than once
In jQuery 1.2 you can now specify a jQuery selector in the URL. Doing so will filter the incoming HTML document, only injecting the elements that match the selector. The syntax looks something like "url #some > selector". Default selector "body>*" always applies. If the URL contains a space it should be escape()d. See the examples for more information.
url | String | |
---|---|---|
The URL of the HTML page to load. | ||
data (Optional) | Map,String | |
Key/value pairs that will be sent to the server. As of jQuery 1.3 a data string can be passed in instead. When using a string, the request is made as a GET. When using an object/map (key/value pairs), the request is made as a POST. | ||
callback (Optional) | Callback | |
The function called when the ajax request is complete (not necessarily success).
function (responseText, textStatus, XMLHttpRequest) { this; // dom element } |
Name | Type |
---|