我是 jquery mobile 的新手,我使用 jquery mobile 和 phoneGap 以及 localstorage Html 开发了一个移动应用程序,我想在 page.html 中保存一个输入值,然后我将使用 localstorage.getitem 检索这个值并在 URL 中使用, 我的问题当我添加这条线时 value=localStorage.getItem('myStorage');
我无法连接到我的应用程序并且我收到了这个错误:
表达式 '$.mobile' [undefined] 的结果不是对象。在文件:///android_asset/www/js/application.js:258
这是我保存输入值 application.js 的应用程序
function setMessage() {
var firstName=document.getElementById('addresseip');
alert("Hello " + firstName.value + ", hope you like JavaScript functions!")
localStorage.setItem('myStorage', firstName.value);
}
这是我在同一页面 .js 中对这个值的调用,输入值是 param.html,对这个值的调用在 index.html 中:
function showUser(){
value=localStorage.getItem('myStorage');
val1 = document.getElementById("name").value;
val2 = document.getElementById("pass").value;
if (val1=="")
{
showdialog("Verifiez login et mot de passe","Erreur");
}
else{
alert("test"+value);
$.mobile.showPageLoadingMsg();
var geturl;
geturl = $.ajax({
url:"https://"+value+":80/B/authenticate",
//url:"https://10.0.2.2:80/B/authenticate",
dataType:"json",
timeout:10000000,
cache:false,
type:'GET',
beforeSend : function(req) {
req.setRequestHeader('Authorization',
make_base_auth (val1, val2));
},
error:function(XMLHttpRequest,textStatus, errorThrown) {
$.mobile.hidePageLoadingMsg();
showdialog("Verifiez login et mot de passe","Erreur");
},
success:function(results) {
if(results==true){
$.mobile.changePage("bienvenu.html","fade");
$.mobile.hidePageLoadingMsg();
}
我的错误是一行 $.mobile.showPageLoadingMsg();
你能帮我吗,谢谢