开发者

How to load json data when changing between pages in jqtouch application?

My application is using JQTouch. The demos show how to GET an html file and display it in the user interface, but I'm loading JSON that I would like to use in a pre-existing DIV. I don't want to create a separate people.html and generate that on the server.

So I have a DIV like this that I would like to load my list of people into the UL.

<div id="people">
<div class="toolbar">
    <h1>People</h1>
    <a href="#" class="back">Back</a>
</div>
<ul class="rounded">
    <li class="sep">F</li>
    <li><a href="#person">Flintstone, <em>Fred</em></a></li>
    <li><a href="#person">Flintstone, <em>Pebble</em></a></li>
    <li><a href="#person">Flintstone, <em>Wilma</em></a></li>
    <li class="sep">J</li>
    <li><a href="#person">Jetson, <em>Elroy</em></a></li>
    <li><a href="#person">Jetson, <em>George</em></a></li>
    <li><a href="#person">Jetson, <em>Jane</em></a></li>
    <li><a href="#person">Jetson, <em>Judy</em></a></li>
</ul>
</div>

This page is loaded from the start of my application with code that looks like this (it's all in the same HTML page):

..snip..
<li class="arrow"><a href="#people">View all</a></li>
..snip..

What do I need to do to call my peo开发者_开发百科ple.aspx service which returns JSON? I think I need to use $.getJSON, create a UL from the JSON, and then call something in jqtouch to transition to my people application page (div).


I think you use the goTo function, e.g.

jQT.goTo("#people")

There's a jsfiddle demo here, but it doesn't test the jqTouch functionality.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜