I want to post some data to php function by ajax, then get the encoded json object that the php function will return, then I want to get the information (keys and values) from this object, but I don't know how, here is my code:
$.ajax({
url: "functions.php",
dataType: "JSON",
data: {id: id},
type: 'POST',
success: function(json){
for(var i=0;i<json.length;i++){
alert(json['fname']);
}
}
});
and here is the json object returned:
[{"id":"1","fname":"kjhkj","mname":"kjhjh","lname":"lname","prefix":"Mr.","suffix":"jhkjhk","email":"[email protected]","image":"11281454_423648214427141_318277024_o.jpg","info":"hjgvhd"}]