JSON object properties are undefined JSON object properties are undefined json json

JSON object properties are undefined


Either put:

header("Content-type: application/jason");

in the PHP, specify dataType: "json" in the AJAX call in the JavaScript, or call JSON.parse.


You will need to parse your string to get a proper JSON object. JSON.parse(response); will provide you with a JSON object from which you can read the properties


Can you try the following example in jsfiddle.

This is not the better way you can use JSON.parse(); or $.parseJSON(); (jquery version)

But if this is your problem, json being returned as a string this fix it and you can alter your code

http://jsfiddle.net/dadviegas/gf8Yq/