Using Jquery for Ajax Functions

We can use Jquery javascript library to implement AJAX(Asynchronous JavaScript And XML) operations effectively. The basic Jquery library is enough to use Jquery ajax functions.

The syntax for a simple AJAX post request is:

$.post(remotepage,post data,callback function, type of request);

Here remote page denotes any server side remote page, post day will be a key and value pair of post data, call back function is the function to call when the request is completed and the type of request is the type of returned data, it may be plain text, xml or json string.

Example:

We can send a simple post request to a remote page in the following way:

$.post(’remotepage.php’,{username:”demouser”,password:”demopass”},show_login_status(login_result));

in the remotepage.php, we can access the value as:

$_POST['username'] & $_POST['password'];

Few more important Jquery AJAX functions are:

load(remoteurl,returned data,callback function);

get(remoteurl,returned data, callback function,type);

Comments are closed.