In my ajax .error function I'm trying to get out the values from the responseText being sent back from the API I'm getting for example
{"error":"Wrong Crendtials","error_description":"Provided username and password is incorrect"}
In my JavaScript its recognising there's errors, but I can't get it to get into the individual items which I want to get to show messages based on the error response?
).error(function (xhr, status, err) {
var errorData = xhr.responseText;
if (errorData != null) {
alert("has errors");
alert("error - " + errorData.error + " - desc " + errorData.error_description);
}
});
I'm sure this is something really basic, but I'm struggling to find an answer that breaks the values down for me?
Thanks
With many thanks to Swati. This was resolved with: