Jquery 在JQTouch中加载带有动画的单独页面

Jquery 在JQTouch中加载带有动画的单独页面,jquery,jqtouch,Jquery,Jqtouch,我正在尝试使用JQTouch将一个数据库驱动的多项选择风格学习网站(用JSP编写)转换成一个iPhone应用程序 如果我将所有Q&a加载到同一个文件中它们自己的div中,我可以使用hashtags链接轻松地在它们之间链接并设置动画,如:a class=“button”href=“#question22” 不幸的是,这并不实际。网站当前运行的逻辑需要调用大量动态生成的页面;我不能把所有的问题都放在同一个平面文件中 我如何动态(预先)加载下一个问题(像AskQuestion.JSP?question

我正在尝试使用JQTouch将一个数据库驱动的多项选择风格学习网站(用JSP编写)转换成一个iPhone应用程序

如果我将所有Q&a加载到同一个文件中它们自己的div中,我可以使用hashtags链接轻松地在它们之间链接并设置动画,如:a class=“button”href=“#question22”

不幸的是,这并不实际。网站当前运行的逻辑需要调用大量动态生成的页面;我不能把所有的问题都放在同一个平面文件中

我如何动态(预先)加载下一个问题(像AskQuestion.JSP?questionId=Kzhctand这样的JSP页面),然后在用户按下按钮后在应用程序中提供该问题

谢谢你的帮助


-多诺万

我为我的抽认卡系统做了类似的事情。 我在当前卡片的“正面”和“背面”有一个div,当用户给出答案时,它会通过ajax、json和php的魔力加载下一张卡片

以下是答案页的相关部分

<h2>Answer:</h2>
<div class="qna">
    <p id="question2" class="qna">SomethingsNotWorking.</p>
    <p id="answer2" class="qna">SomethingsNotWorking.</p>
</div>
<h2>Did you know it?</h2>
<a >Submit</a>
<BR><a href="#" onClick="javascript:sendCardInfo('Yes')" name="knewIt">Yes</a>
<BR><a href="#" onClick="javascript:sendCardInfo('No')" name="knewIt">No</a>
在后端,我有一个名为ajax.PHP的PHP页面,将下一张卡生成为JSON

    function sendCardInfo(str){
    //alert("sendCardInfo " + str);  
    $.ajax({
       type: "POST",
       url: "ajax.php",
       data: "currentCard="+$(document).data('currentCard')+"&currentDeck="+$(document).data('currentDeck')+"&knewIt="+str,
       dataType: "json",
       success: function(data){
            jQT.goTo('#home', 'swap');
            // store the json response in the data object so it can be retrieved later.
            $(document).data( "currentCard" , data.currentCard); 
            $(document).data( "currentDeck" , data.currentDeck);
            $(document).data( "question" , data.question);
            $(document).data( "answer" , data.answer);

            // update the q and a divs with the current questions.
            $('#question1').html( $(document).data( "question" ) );
            $('#question2').html( $(document).data( "question" ) );
            $('#answer2').html( $(document).data( "answer" ));
       },
     });
}