Jquery Ajax Perform Async., HTTP Ajax Request.
jQuery.ajax(url,[settings])
Jquery Ajax() |
Url
A string containing the URL to which the request is sent.
Jquery Ajax simple Code:
context
$.ajax({url: "test.html",context: document.body}).done(function() {$( this ).addClass( "done" );});
another example:
var jqxhr = $.ajax({ url: "/test.html", data: { name : "The name", desc : "The description" } }) .done (function(data, textStatus, jqXHR) { alert("Success: " + response) ; }) .fail (function(jqXHR, textStatus, errorThrown) { alert("Error") ; }) .always(function(jqXHROrData, textStatus, jqXHROrErrorThrown) { alert("complete"); }) ;
Disclaimer: Not all these snippet are written by me. Some of them are collected from other sources on Internet.