im having some problems outting my returned array – on console log it shows
{
"text":"{\"error\":false,\"msg\":\"found in search\"}",
"data":{
"notifications":[
]
}
}
im using
success : function(data){
$('#waiting').hide(500);
$('#message').removeClass().addClass((data.error === true) ? 'error' : 'success').text(data.msg).show(500);
if (data.error === true)
$('#restricted_locator').show(500);
},
however data.msg returns undefined, but now looking at the array its got nothing to fetch but how can i change to get the data from text?
Thanks in advance!
If I’m not mistaken, you have to parse “data” to JSON using
jQuery.parseJSON(data)or$.parseJSON(data)so your code should be: