Before you make the $.ajax call or $.post call or whatever, you do this:
var parameters = {}; //declare the object parameters["prop1"] = "value1"; //set some value parameters["prop2"] = "value2"; //and again
Then, when you're making the actual request, you pass your object on the data field
$.ajax({ type: "POST", url: "some.php", data: parameters, success: function(msg){ alert("nothing"); } });
and voilá! you can build your parameters in a nice way, instead of "prop1=value1&prop2=value2"
Be back soon :)
No comments:
Post a Comment