how to create dynamic pages using PHP, JSON and JQuery

Go To


I am creating a mobile app using jquery mobile, PHP using JSON for fetching the data and PhoneGap to convert to a native App for iOS, Andorid, BB ext. The problem i have is that i want to create dynamic pages but using only AJAX and JQuery Mobile pages because otherwise i cannot create a native app. The problem that i have for the moment is that i want to create dynamic pages for example i fetch all the news titles and display them using a list-view and then after tapping the title of the news i want to display a page of the full news just likestandford has done the events page

2012-04-04 19:13
by Agli Panci
So what is your question - Symeon Breen 2012-04-04 19:16
I dont know how to do the part of dymanic pages, for example in php you can do news.php?id=234 and display a specific article but i want to do this using json and jquer - Agli Panci 2012-04-04 19:33


You cannot use PHP pages (or aspx, etc.) with Phongap, they have to be HTML, because you cannot run server-side code within Phonegap. That being said, you can accomplish the dynamic behavior by fetching your data from an external server with ajax calls.

This page in the documentation talks about using dynamic JSON data to build pages:

The stanford demo seems to be using a multi-page template discussed here, not dynamic JSON data:

2012-04-04 19:57
by servarevitas3
I know that i have explained that i have done the fetching using ajax and JSON so i can fetch all the data from PHP since i cannot use PHP in phonegap, what i dont know how to do is creating dynamic pages with jquery, you can see the StandFord example, they have a list of event titles, and after you click to a title i want a new page to open with the full content - Agli Panci 2012-04-04 20:04
This is what i have done to bringout the titles, now i have the titles i want to make then clickable and after you click to a title to show the full news. jQuery(function($){

$.getJSON('URL_TO_FILE.php', function(data) {

$.each(data['cotegory'], function(i,row){ var title = row.title; var content = row.content; $('#newslist').append('

'+ title +'


}) - Agli Panci 2012-04-04 20:05 - servarevitas3 2012-04-04 20:07