{"action":"created","issue":{"url":"https://api.github.com/repos/eclipsesource/tabris-js/issues/231","labels_url":"https://api.github.com/repos/eclipsesource/tabris-js/issues/231/labels{/name}","comments_url":"https://api.github.com/repos/eclipsesource/tabris-js/issues/231/comments","events_url":"https://api.github.com/repos/eclipsesource/tabris-js/issues/231/events","html_url":"https://github.com/eclipsesource/tabris-js/issues/231","id":53842348,"number":231,"title":"jQuery ajax() post request problem with application/json content type","user":{"login":"jkrause","id":624059,"avatar_url":"https://avatars.githubusercontent.com/u/624059?v=3","gravatar_id":"","url":"https://api.github.com/users/jkrause","html_url":"https://github.com/jkrause","followers_url":"https://api.github.com/users/jkrause/followers","following_url":"https://api.github.com/users/jkrause/following{/other_user}","gists_url":"https://api.github.com/users/jkrause/gists{/gist_id}","starred_url":"https://api.github.com/users/jkrause/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jkrause/subscriptions","organizations_url":"https://api.github.com/users/jkrause/orgs","repos_url":"https://api.github.com/users/jkrause/repos","events_url":"https://api.github.com/users/jkrause/events{/privacy}","received_events_url":"https://api.github.com/users/jkrause/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/eclipsesource/tabris-js/labels/bug","name":"bug","color":"333333"}],"state":"closed","locked":false,"assignee":{"login":"cpetrov","id":2341769,"avatar_url":"https://avatars.githubusercontent.com/u/2341769?v=3","gravatar_id":"","url":"https://api.github.com/users/cpetrov","html_url":"https://github.com/cpetrov","followers_url":"https://api.github.com/users/cpetrov/followers","following_url":"https://api.github.com/users/cpetrov/following{/other_user}","gists_url":"https://api.github.com/users/cpetrov/gists{/gist_id}","starred_url":"https://api.github.com/users/cpetrov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cpetrov/subscriptions","organizations_url":"https://api.github.com/users/cpetrov/orgs","repos_url":"https://api.github.com/users/cpetrov/repos","events_url":"https://api.github.com/users/cpetrov/events{/privacy}","received_events_url":"https://api.github.com/users/cpetrov/received_events","type":"User","site_admin":false},"milestone":null,"comments":1,"created_at":"2015-01-09T07:51:27Z","updated_at":"2015-01-09T10:02:46Z","closed_at":"2015-01-09T10:02:46Z","body":"When using jQuery for post requests there seems to be a problem with honoring the contentType. It seems that the data always gets urlEncoded instead of using the encoding specified by the contentType property.\r\n\r\nTo reproduce:\r\n$.ajax({\r\n    type: \"POST\",\r\n    contentType: \"application/json\",\r\n    url: \"http://locahost:8080/postToMe\",\r\n    data: {\"item\": \"007\", \"quantity\": 5},\r\n}).done(function(response) {\r\n   console.log(response);\r\n)}.fail(function(jqXHR,error,msg) {\r\n  console.log(error + \" \" + msg);\r\n});"},"comment":{"url":"https://api.github.com/repos/eclipsesource/tabris-js/issues/comments/69314872","html_url":"https://github.com/eclipsesource/tabris-js/issues/231#issuecomment-69314872","issue_url":"https://api.github.com/repos/eclipsesource/tabris-js/issues/231","id":69314872,"user":{"login":"cpetrov","id":2341769,"avatar_url":"https://avatars.githubusercontent.com/u/2341769?v=3","gravatar_id":"","url":"https://api.github.com/users/cpetrov","html_url":"https://github.com/cpetrov","followers_url":"https://api.github.com/users/cpetrov/followers","following_url":"https://api.github.com/users/cpetrov/following{/other_user}","gists_url":"https://api.github.com/users/cpetrov/gists{/gist_id}","starred_url":"https://api.github.com/users/cpetrov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cpetrov/subscriptions","organizations_url":"https://api.github.com/users/cpetrov/orgs","repos_url":"https://api.github.com/users/cpetrov/repos","events_url":"https://api.github.com/users/cpetrov/events{/privacy}","received_events_url":"https://api.github.com/users/cpetrov/received_events","type":"User","site_admin":false},"created_at":"2015-01-09T10:02:46Z","updated_at":"2015-01-09T10:02:46Z","body":"When passed as an object, data gets URL encoded. To prevent this from happening one should first serialize the object with JSON.stringify(...) or set the processData jQuery Ajax configuration parameter to `false`. From the jQuery documentation:\r\n\r\n> **processData (default: true)**\r\n> *Type: Boolean*\r\n> By default, data passed in to the data option as an object (technically, anything other than a string) will be processed and transformed into a query string, fitting to the default content-type \"application/x-www-form-urlencoded\". If you want to send a DOMDocument, or other non-processed data, set this option to false."}}