javascript - JSON data 400 Bad request Error -
i have json data sending server. when submit printing data in console not sending server.
it gives following error
post http://localhost:8080/rest/review/createreview 400 (bad request)
here code
var promise = jquery.ajax({ url: 'http://localhost:8080/rest/review/createreview', type: 'post', data: '{myreview: myreview}', datatype: "text", contenttype: "application/json", success: function (data) { console.log("request successful", data); }, error: function (data) { console.log("request failed", data); } });
it may data not valid json. try:
data: json.stringify({myreview: myreview})
Comments
Post a Comment