Before I forget – Sending POST variables using jQuery

Written by James McDonald

April 5, 2011

You can pass in POST variables as follows with key=value pairs thusly:

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

or using an object

var ref_num_url = "http://yourserver/cgi-bin/"; 	
$.ajax ({
	url: ref_num_url,
	type: "POST",
	data: { "environment": 'TEST', "blah": "foo"},
	dataType: "xml",
	success: function(myxml){
                      // this says using the returned xml find the
                      // refnum element and give me the text in it
                      // e.g 1234567 returns 1234567
	         alert($( myxml, "refnum").text());

}); // end ajax


Submit a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.

You May Also Like…

Meraki Open Source Licenses

Until today I assumed that Meraki was built in-house with only closed source software. But having a look at the...


If you have Veeam backup failing with the Updating BCD failed with Cannot update SafeBoot flag and SentinelOne is...