In my ajax code:
$.ajax({ url: CI_ROOT + "isUserExist", type: "GET", data: {recepient: recepient}, success: function(r) { console.log(r) } })
Gives me the exit [{"records": "1"}] [{"records": "1"}] So I parsed it json by adding dataType: "json" in my ajax code. But when I disassembled it, it does not give me a way out, but an error in try-catch-block.
How do I display it as objects? In my PHP code, I do this:
for ($i = 0; $i < count($matches[0]); $i++) { echo json_encode($this->searchmodel->doesUsersExists($matches[0][$i])); }
source share