【发布时间】:2014-05-10 09:23:51
【问题描述】:
我正在使用 cordova + Ripple 模拟器 + jq mobile 开发 android 应用程序。我想在成功登录后更改页面。主(也是唯一)页面的 html:
<div data-role="page" id="login">
<div data-role="header">
<h1>
Вход
</h1>
</div>
<div class="ui-content">
<div id="loginFlashMsg">
</div>
<form id="loginFrm">
<div>
<label for="loginInptTxt">Ваш логин:</label>
<input type="text" id="loginInptTxt" />
</div>
<div>
<label for="pswInptTxt">Пароль:</label>
<input type="password" id="pswInptTxt" />
</div>
<button id="loginBtn">
Войти
</button>
</form>
</div>
</div>
<div data-role="page" id="lots">
<div data-role="header">
<h1>
Лоты
</h1>
</div>
<div class="ui-content">
<ul data-role="listview" id="lotsList">
</ul>
</div>
</div>
在 json 授权后我想更改页面:
App.prototype.ProcessResponse = function (response, textStatus, jqXHR) {
if (response['status'] != 'ok') {
this.notifyAboutError(response['status']);
} else {
switch (response['action']) {
case 'login':
this.user = new User($('#loginInptTxt').val(), response['sid']);
$.mobile.changePage("#lots");
break;
case 'getLots':
this.appendLots(response['lots']);
}
}
};
但它不起作用。我知道,changePage() 已被弃用。我尝试使用
$(":mobile-pagecontainer").pagecontainer("change", "$lots");
但一切都还是一样 - 什么都没有。提取到另一个 html 页面没有效果。如何在我的 Android 应用中切换页面?
附言我能做到的最好的事情是我看到很多页面的标题和文本“正在加载”,但在第二个之后它消失了。
【问题讨论】:
标签: javascript android jquery-mobile cordova