Summary of the usage of ajax method data parameter in Jquery

  • 2020-03-30 01:40:08
  • OfStack


$.ajax({
   type: "POST",
   url: "some.php",
   data: "name=John&location=Boston", //The first way is to pass parameters
  // data: {name:"John",location:"Boston"}  // The second way is to pass parameters 
  //Data: {foo: [" bar1 ", "bar2"]} is converted to a '& foo = bar1 & foo = bar2'
  
   success: function(msg){
     alert( "Data Saved: " + msg );
   }
});

Related articles: