开发者

How to load dynamic pages with JQTouch

I am trying to build a web app with JQTouch. I actually have it all working nicely if I hard code all the content in. However, the site needs to be entirely dynamic.

Before a user logs in, there is to be only one page visible - a login page. Once logged in, the app downloads content that that particular user is allowed to see. For example, user 1 may be able to see a home page with 3 links on, each link pointing to a page containing 3 more links. user 2 may only see 2 links on the home page, but the first pointing to a page that contains two more links, and the second pointing to a page that contains 5 more links. The number of pages is dynamic, and different for every user. Because of this, I cannot create div's to load content into.

How can I set up this in JQTouch. I want each page to load on demand. I don't need the code to achieve this, just the theory behind it. For example, do I create a "template" div, and clone it each time a new page is to be loaded, or do I run a script to work out how many divs I will need, and then create them all?

Any adv开发者_开发百科ice would be greatly welcome.

Thanks


I think you want to load your pages via AJAX. You can see this in their demo. Just go to AJAX > GET Example.

Take a look at the answer I posted on another question: jQTouch execute code when AJAX page is loaded

If you want to put the logic in the front-end, you could simply use the pageAnimationEnd callback function documented here: http://code.google.com/p/jqtouch/wiki/CallbackEvents.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜