I am making a listview using JSON and are successfull with this, but... I was wandering if it was possible to send other data to my page, which is "not in an array" with the same JSON call without having to put them through the $each?
Here is my JSON: ---EDIT---
[{"menutime":"2013-04-23 19:23:42"},{"list":"menu1"},{"list":"Menu2"},{"list":"Menu3"}]
As you can see, I have 3 "list" which I get into an listview like this:
dataCallback = function (data) {
var content = [];
// var now = data.menutime; // HERE I WANT THE MENUTIME TO BE PUT INTO A VARIABLE //
$.each(data, function (i, val) {
content.push(val.list); // GETTING ALL THE MENUS //
});
$('#games').html(content.join('')).listview('refresh');
}
I don't get the menutime... How do I do this?
Thanks in advance :-)
---------------- EDIT ----------------
I have tried this like Kevin B has suggested but I cant get it to work?!
dataCallback = function(data){
alert("Date: "+data.menutime);
//var content = data.list.join("");
//var now = data.menutime; // HERE I WANT THE MENUTIME TO BE PUT INTO A VARIABLE //
$('#userbar').html(data.profile); // FETCHING USERS DATA FOR PROFILEBAR //
//$('#games').html(content).listview('refresh');
}
In my alert I get "Undefined".
My "jason" looks like this:
([{"menutime":"2013-04-25 15:57:50"},{"profile":"troels"}])
Any ideas why this dont work?