Using AJAX, I am retrieving some data that I need to manipulate after the AJAX call completes. However, I am facing an issue where I can't seem to manipulate the response. Here is the code snippet:
function testAjax() {
direc = "controller.php";
return $.ajax({url: direc});
}
var obj = testAjax();
console.log(obj);
console.log(obj.responseText);
The console.log(obj) output is as follows:
XMLHttpRequest { readyState=1, timeout=0, withCredentials=false, more...}
Response:
"[{"CLICREDIT_Cod":"1002","CLICREDIT_Credit":"2000","CLICREDIT_FlagEstad":"1"}]"
responseText:
"[{"CLICREDIT_Cod":"1002","CLICREDIT_Credit":"2000","CLICREDIT_FlagEstad":"1"}]"
The console.log(obj.responseText) returns an empty string.
I have attempted methods like JSON.parse to manipulate the data, but none seem to work. Any assistance in this matter would be greatly appreciated. Thank you.