Documentation

Talk:Ajax/jQuery.post

From jQuery JavaScript Library

Jump to: navigation, search

How is the data that is being sent encoded ? JSON ? other ? Is there any way to change it ? Is it possible to post JSON encoded params using this function ? For example:

|code= var json_params = { search_string: search_string, type: "user" };

  $.post(
       "foo.php", 

{ ajax: 1, params: JSON.stringify(json_params) },

  );

Would that be possible ?


for above: $.post("foo.php",json_params);



This page could use some examples for n00bs like me if some one is so inclined. Took me a while to figure out that I could send the data as {value: pairs}.