Post Data using Jquery Post

Jquery is widely used JS Library because it will work for all browsers and will support all devices .Posting data to Web server using Jquery is simpler then posting data using Javascript Ajax .In javascript Ajax we need to use many function call and callbacks but in Jquery two simple methods are available jquery post(),ajax() .

Below i am explaining one of them that is post().

Basic Syntax:  post(‘URL’,’JSON DATA’,CALLBACK’);

To post the data using post() method need to prepare our data in json format .

$.post('process.php',{fieldname:value,fieldname1:value1,fieldname2:value2},function(str){

		if(str=='Success'){
                       // process.php is processing the data and returning Success if all done 
		       //DO Something

		}else
                {
                      //Do something Else 
                }
});

Don’t forget to include jquery latest library .if you are using more then one libs and some conflict coming you should use
jQuery.noConflict(true);

Hope above article will help you to build some nice code .

Show Buttons
Hide Buttons