I am trying, as a new developer, wrap my head around the best approach to load a JSON file, create some sort of template with variables or placeholders, without using jquery to build DOM elements, since its a complex div.
To make it more complicated I would like to have a onClick event to a set of tabs in this case dates (since this is a event calendar) and have it load 5 events for each date, without reloading the page, which is where ajax comes in.
Here is my JSON function:
Any help in getting this working or some way help me understand the best way to do this, would be greatly appreciated.Code:function getEvents() { $foo['events'] = array( array('id'=>'1', 'title'=>'My Title'), array('id'=>'2', 'title'=>'My Title2'), array('id'=>'3', 'title'=>'My Title3'), array('id'=>'4', 'title'=>'My Title4'), array('id'=>'5', 'title'=>'My Title5') ); echo json_encode($foo); }


Reply With Quote

Bookmarks