Wednesday, 14 December 2011

Ajax

AJAX = Asynchronous JavaScript and XML.

AJAX is the art of exchanging data with a server, and update parts of a web page - without reloading the whole page.

You can call function that contain AJAX on any event as:- onclick, onsubmit etc. of the form or button.

As:- <button type="button" onclick="functionname()">Change Content</button>

Syntex of AJAX in any function is : -

function anyname() {
      $.ajax({ 
            type: "POST",
            url: webURL + "path",   
            data: "variable="+value,  
            success: function(msg)     
            {
              if(msg!='')
                {--------}
            }
        });
}

//path is :-path of controller and its function you want to call for processing .
// variable :-parameters you want to sent .
// msg :- after return from controller 'msg' contain values that controller return.

No comments:

Post a Comment