Using jquery, what is the simplest function to post some json data and process a returned json respo

Posted by Chris Boesch on Stack Overflow See other posts from Stack Overflow or by Chris Boesch
Published on 2010-03-12T14:57:38Z Indexed on 2010/03/12 15:07 UTC
Read the original article Hit count: 108

Filed under:
|

When users click on an element in my webpage, I would like to call a javascript function that reads the values of a few text boxes on the page, wraps their contents as json where the keys are the ids for the text boxes and the values are the contents of each text box, and then posts the resulting json to a url.

I would then like the same function to expect back a json response and call another javascript function with the returned json data.

Question: What is the best way to write the javascript function to create a json structure from html elements, post the json with jquery, and call another javascript function with the resulting json response from the server?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about JavaScript