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?