i need to loop over the below json but the below code is looping over each character in my json and displaying "undefined": (is there anything wrong with the below json??? Any help is appreciated)
{"news_id":"1","news_title":"News Title One","news_date":"2012-03-20","news_pic":"album-bb[6].jpg","news_desc":"Here goes the news title one Here goes the news title one Here goes the news title one Here goes the news title one.","gallid":"3"}
{"news_id":"2","news_title":"News Title Two","news_date":"2012-04-14","news_pic":"174863_163190093755777_2032987021_q.jpg","news_desc":"News Title Two News Title Two News Title Two News Title Two News Title Two News Title Two News Title Two News Title Two News Title Two News Title Two News Title Two News Title Two News Title Two News Title Two News Title Two News Title Two News Title Two News Title Two News Title Two News Title Two.","gallid":"0"}
This is my code which is being fired on click event:
var phpNews;
var NewsObject;
$(document).ready(function () {
$("#btnNewsPage").click(function()
{
$.post("server/news.php",null,function(e){
NewsObject = e;
$.mobile.changePage("#NewsPage");
});
});
$('#NewsPage').live('pagebeforeshow',function(event, ui){
var list;
$.each(NewsObject, function(k,v){
list = v.news_title;
});
$("#displayNews").html(list);
});
})