Contact

If you like a new Web or Desktop
application, update a existing one
or add new modifications. Your at
the right place and hit the
hire me button

Follow

If your intersted you can follow
me on Twitter by clicking here

Web and Apps Building Refernce World Wild Web UNIX Apps AND Tips Programming languages

ajax examples

Load and execute a JavaScript file.

$.ajax({
type: "GET",
url: "test.js",
dataType: "script"
});

* Code

Save some data to the server and notify the user once it's complete.

$.ajax({
type: "POST",
url: "some.php",
data: "name=John&location=Boston",
success: function(msg){
alert( "Data Saved: " + msg );
}
});

* Code

Retrieve the latest version of an HTML page.

$.ajax({
url: "test.html",
cache: false,
success: function(html){
$("#results").append(html);
}
});

* Code

Loads data synchronously. Blocks the browser while the requests is active. It is better to block user interaction by other means when synchronization is necessary.

var html = $.ajax({
url: "some.php",
async: false
}).responseText;

* Code

Sends an xml document as data to the server. By setting the processData option to false, the automatic conversion of data to strings is prevented.

var xmlDocument = [create xml document];
$.ajax({
url: "page.php",
processData: false,
data: xmlDocument,
success: handleResponse
});

* Code

Sends an id as data to the server, save some data to the server and notify the user once it's complete.

bodyContent = $.ajax({
url: "script.php",
global: false,
type: "POST",
data: ({id : this.getAttribute('id')}),
dataType: "html",
success: function(msg){
alert(msg);
}
}
).responseText;

Name Type
Retrieved from "http://docs.jquery.com/Ajax/jQuery.ajax"