ajax - Put jquery with django rest api -


i trying update data via ajax jquery.

when use api update data works correctly. when try use ajax put not update.

$.ajax({             type: 'put',             url: "/api/attend/" + this.props.id + ".json",             headers: { 'authorization': "token " + token },             data: json.stringify({attend_ts: '2016-07-05t13:44:21.855910z'}),             success: (result) => {                 console.log("success")             },             error: function (cb) { cb }         }); 

the data not update, jquery returns success @ console.

i found error, set datatype:

$.ajax({             type: 'put',             url: "/api/attend/" + this.props.id + ".json",             headers: { 'authorization': "token " + localstorage.token },             data: {                 report: 'test'             },             datatype: "json",             success: (result) => {                 console.log("success")             },             error: function (cb) { cb } }); 

report field database


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -