Backbone.js getting data on POST request

后端 未结 2 582
醉酒成梦
醉酒成梦 2021-01-22 08:58

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

2条回答
  •  爱一瞬间的悲伤
    2021-01-22 09:41

    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();
            }
        });
    

提交回复
热议问题