Ajax with Jquery

Following is simple example code can be use to send the ajax requests using JQuery.
Sending Ajax request with JQuery is much more easier than can apply more user friendly messages to user

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


Note : In IE browsers it convert and process the XML response string as Text prevent that
can use as following

url: "data.xml",
dataType: ($.browser.msie) ? "text" : "xml",
success: function(data){
var xml;
if (typeof data == "string") {
xml = new ActiveXObject("Microsoft.XMLDOM");
xml.async = false;
} else {
xml = data;
// Returned data available in object "xml"

There are much more options can be specified in ajax request.

url: 'document.xml',
type: 'GET',
dataType: 'xml',
timeout: 1000,
error: function(){
alert('Error loading XML document');
success: function(xml){
// do something with xml



Response XML can be process as follows and populate the required stuff

success: function(xml){
var item_text = $(this).text();

  • ')




    Popular posts from this blog

    PostgreSQL bytea and oid

    MySQL as Hive metadata store

    Big Memory Go.