About Json_encode And Ajax Datatype: "json"
In my ajax code: $.ajax({ url: CI_ROOT + 'isUserExist', type: 'GET', data: {recepient: recepient}, success: function(r) { console.log(r
Solution 1:
Add each entry to an array and then json encode that array, instead of json encoding each one separately. If you only have one call to json_encode, you will get valid JSON:
$result = array();
for ($i = 0; $i < count($matches[0]); $i++) {
$result[] = $this->searchmodel->doesUsersExists($matches[0][$i]);
} //gets the user id of the user from a given string.echo json_encode($result);
Solution 2:
That's not valid JSON. Make an array from your exist results and encode that.
Post a Comment for "About Json_encode And Ajax Datatype: "json""