url_date = ""; url_price= ""; url_event= ""; url_page = ""; page = 0; function update() { $.getJSON(url+url_date+url_price+url_event+url_page, function(data) { showpage = parseInt(page)+1; pages = data.total_pages; $('#page').html(showpage); $('#total_pages').html(data.total_pages); $('#total_events').html(data.total) var events = []; var id=0,event_image=1,event_title=2,oname=3,start_date=4,end_date=5,start_time=6,end_time=7,event_address=8,event_city=9,event_state=10; $.each( data.aaData, function( key,val ) { if( data.aaData[key][event_image] ) events.push( "

"+data.aaData[key][event_title]+"

Organized by "+data.aaData[key][oname]+"

"+data.aaData[key][start_date]+"
"+data.aaData[key][event_address]+"

Register
" ); else events.push( "

"+data.aaData[key][event_title]+"

Organized by "+data.aaData[key][oname]+"

"+data.aaData[key][start_date]+"
"+data.aaData[key][event_address]+"

Register
" ); }); $('.event-listing').html(events); str=""; for(i=0; i"+pn+" "; } $('.paging').html(str); }); } $(document).delegate('a.page','click',function(){ page = $(this).attr('page'); url_page = "&page="+page; update(); }); update();