Skip to content Skip to sidebar Skip to footer

Parsing Json Ajax Response

I'm running into trouble parsing a JSON response. I've done this lots of times but this is not working for a reason I cannot discern. Here is what I'm doing: Before anyone suggests

Solution 1:

You are settingdataType: 'json'. This means that jQuery will parse the result as JSON for you.

Lose the data = $.parseJSON(data); line, then it should work.

Also, as @SLaks pointed out: in your PHP, $response is already in JSON format. No need to json_encode it. Just echo $response.

Post a Comment for "Parsing Json Ajax Response"