jquery list view to load json data is not working please help me-Collection of common programming errors
jquery mobile list view to load json data is not working please help me
i am created php code to ganerate json file, i am trying load that json data to my jquery mobile list view but it is not loading
crome console error is: “Uncaught ReferenceError: json is not defined “
please solve this
my jquery mobile index.html code is
View Source
Categories
$(document).on('pagebeforeshow', '#cat', function(){ var url="http://localhost:8888/coupns/index.php"; $.getJSON(url,function( data ){ //loop through deals $.each(json.posts,function(i,dat){ $("#list").append("
ID: "+dat.id+ " Name: "+dat.shop+ " Description: "+dat.dec+ " Limit: "+dat.cat+ " Rest ID "+dat.expdate+ "
"); }); $("#list").listview('refresh'); }); });
Categories
By Shop
By Shop
Page Two
Categories
By Shop
my php json encode code is
my json data out put is is
{"posts":[{"post":{"id":"1","shop":"ebay.in","cat":"online shopping all ","expdate":"2013-06-30","dec":"Credit Card\t 6% Off!\tUse Coupon Code:\r\nCHDFCEBAY1"}}]}
-
$.each(json.posts,function(i,dat){
this should be$.each(data.posts,function(i,dat){
Originally posted 2013-11-15 09:10:43.