I am new to backbone.js.I am trying to POST data with my service and it returns me data. My service is: http://192.168.1.3:8080/app/search/candidate
It takes Input
By default, Backbone requests media type "application/json", and it looks like your server can't handle that. To work around that, look into emaulateJSON
http://backbonejs.org/#Sync-emulateJSON
This code worked, see the request headers in the console is this jsfiddle :
this.coll.fetch({
beforeSend: function (xhr) {
xhr.setRequestHeader('Content-Type', 'application/json');
},
data: JSON.stringify({'skills':['c','java']}),
type: 'POST',
success: function () {
//console.log(this.coll.toJSON());
self.render();
}
});