Jquery mobile和PhoneGap:重新加载页面以获取数据库中的下一项

Jquery mobile和PhoneGap:重新加载页面以获取数据库中的下一项,jquery,cordova,jquery-mobile,Jquery,Cordova,Jquery Mobile,我想在用户向右滑动到数据库中的下一项(id将增加1)后重新加载页面,但它不起作用。它显示警报(ID+1),但页面仍不会重新加载或更改页面(同一页面)以获取新项目 $('#word').live( 'swipeleft', function( e ) { alert( 'You swiped right!' ); if(parseInt(sessionStorage.currWord_ID) >= parseInt(sessionStorage.firstWordID) &&

我想在用户向右滑动到数据库中的下一项(id将增加1)后重新加载页面,但它不起作用。它显示警报(ID+1),但页面仍不会重新加载或更改页面(同一页面)以获取新项目

$('#word').live( 'swipeleft', function( e ) {
alert( 'You swiped right!' );
if(parseInt(sessionStorage.currWord_ID) >= parseInt(sessionStorage.firstWordID) && parseInt(sessionStorage.currWord_ID) < parseInt(sessionStorage.lastWordID)){
    sessionStorage.currWord_ID = parseInt(sessionStorage.currWord_ID) + 1;
    alert("ID +1");
    $.mobile.changePage($("#word"),{transition: "pop",reloadPage: true});
}

 } );   
$('word').live('swipleft',函数(e){
警惕(‘你打对了!’);
if(parseInt(sessionStorage.currWord\u ID)>=parseInt(sessionStorage.firstWordID)&&parseInt(sessionStorage.currWord\u ID)
要重新加载/刷新页面,您可能需要尝试以下方法:

$('#word').live( 'swipeleft', function( e ) {
    alert( 'You swiped right!' );
    if(parseInt(sessionStorage.currWord_ID) >= parseInt(sessionStorage.firstWordID) &&   parseInt(sessionStorage.currWord_ID) < parseInt(sessionStorage.lastWordID)){
        sessionStorage.currWord_ID = parseInt(sessionStorage.currWord_ID) + 1;
        alert("ID +1");
        $(location).attr('href',"index.html");
    }
});
$('word').live('swipleft',函数(e){
警惕(‘你打对了!’);
if(parseInt(sessionStorage.currWord\u ID)>=parseInt(sessionStorage.firstWordID)&&parseInt(sessionStorage.currWord\u ID)

确保您的HTML文件“index.HTML”中只定义了一个jquery移动页面(在您的例子中是“word”)。

@AmySukumunu:您是否尝试了$(location.attr('href',“index.HTML#word”);:SIt get应用程序错误:与服务器的连接不成功(index.html)@AmySukumunu:这个如何:document.location=“index.html#word”?这应该有用…加在一起?document.location=“index.html#word”;然后是$(location.attr('href',“index.html#word”)?好的,朋友,检查上面修改的解决方案。这应该正常工作。让我知道你会得到什么结果。