I use flask 0.12 and try to send a PUT request using ajax. However, I get an error No JSON object could be decoded when use .get_json()
method. The content is json and is_json
returns True. There is my client-side code:
$.ajax({
url: apiTechnicians,
type: 'PUT',
data: { "technicianUserId": chosenTechnician.val() },
contentType: "application/json",
dataType: "json",
success: function (result) {
console.log(result)
}
});
And there is the server-side code:
@api.route("/technicians", methods=['PUT'])
def putTechnicians():
print request.is_json
jsonResult = request.get_json()
return Response(status=200)
Any suggestions how should I work with the received data and why get_json()
can't decode the data?