I get JSON data with jquery.ajax and dataType is "JSON" But I have some problem
This is my JSON data :
{
"stock": {
"head": [
"name",
"est",
"date"
],
"body": [
{
"row": [
"TEST",
"10.58",
"2013-09-05 13:37:20"
]
}
]
},
"year": {
"head": [
"name",
"est",
"date"
],
"body": [
{
"row": [
"TEST",
"0",
"2013-09-05 13:37:35"
]
}
]
}
}
This is my javascript code:
var getdata = $.ajax({
type : 'POST',
url : 'testjson.php',
data : data,
dataType : 'json'
});
getdata.done(function(result){
var queryHead = result.stock.head; // This returns data
var queryBody = result.stock.body; // But this doesn't return data. Empty
});
JSON data successfully returned, but not being parsed correctly.
queryHead
works fine but queryBody
does not work
console.log(result
) at least? – meagar♦ Sep 16 '13 at 2:07