jQuery posting JSON

The Solution to jQuery posting JSON is

You post JSON like this

$.ajax(url, {
    data : JSON.stringify(myJSObject),
    contentType : 'application/json',
    type : 'POST',

if you pass an object as settings.data jQuery will convert it to query parameters and by default send with the data type application/x-www-form-urlencoded; charset=UTF-8, probably not what you want

~ Answered on 2012-11-02 23:41:07

Most Viewed Questions: