My AJAX call keeps returning response object instead of the expected value
function check_now(word)
{
var x = $.ajax({
url: "{% url 'checker' %}",
data: {
'word': word,
'csrfmiddlewaretoken': '{{ csrf_token }}',
},
async:false,
type: "POST",
dataType: 'json',
statusCode: {
200: function (response) {
console.log(response.is_command);
return response.is_command;
}
}
});
return x;
}
Expected result is a boolean. Output of console.log(response.is_command) is printed correctly as false. But returned value x is still an object. I can't access the is_command. How to access it?