I have a php web page returning json string. json string is like this .
{
"employees": [
{
"fname": "sdsdsd",
"lname": "sdsd",
"phone": "sdsd",
"gender": "female",
"dob": "1990-03-11",
"address": "03",
"nic": "erer",
"email": "erererer",
"empid": "ererere",
"designation": "sdsds",
"qualifications": "dsds"
}
]
}
this is a dynamic page (values can change). i want to display these strings in a jquery mobile listview. please tell me how should my javascript function looks like..
Append extra an [
and ]
to the beginning and end of the string. This will make it an array.
jQuery:
var json = '{"id":1,"name":"Test1"},{"id":2,"name":"Test2"}';
var jsonArray = $.parseJSON('[' + json + ']');
JavaScript:
var jsonArray = eval('(' + json + ')');
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments