I am trying to execute jQuery Ajax request with the following code:
$.ajax({
url: '<MY_URL>',
type: 'POST',
contentType: 'application/json;charset=UTF-8',
data: JSON.stringify(data),
dataType: 'application/json',
success: getParsedData,
error: function (xhr, ajaxOptions, thrownError) {
alert(xhr.status + ' ' + $.parseJSON(xhr.responseText['message']);
},
xhrFields: {
withCredentials: true
}
});
Instead of executing function specified in success variable, I am getting alert popup with value 200 (which is valid request).
In developer tools in the browser I can also see:
Remote Address: ...
Request URL: ...
Request Method: POST
Status Code:200 OK
Can you please advise how to troubleshoot/handle it further to have success/error functions to be executed correctly.
console.log(xhr, ajaxOptions, thrownError)to get better details.