jquery send json post ajax
Load data asynchronously from the server using GET or POST HTTP requests. Set data type (xml, json, script, text, html) and decode returned data. The following helper function allows sending an Ajax request via GET method - an equivalent to jQuerys .get(). Im new in PHP/jquery I would like to ask how to send json data from a form field like (name, age, etc) with ajax in a json format.Sending data from formfields back to the server (php) is usualy done by the POST method which can be found back in the superglobal array POST inside PHP. Here is a good live example of jQuery AJAX and POST from one of my clients, a free keyword suggestion tool for advanced SEO marketers.If we want to respond with JSON, well send a Content-Type: application/ json and a properly formatted JSON string without any extra characters jQuery. will now send TWO requests, one to complete the handshake and one with the actual content. This is for your own security, somehow.This should do the trick: .ajax( url: url, type: "POST", data: JSON.stringify(data), contentType: "application/ json", complete: callback ) .postJSON() for jQuery. .