Tag: cordova

将多个图像上传到api – phonegap

我在一个phonegap项目中,我有一个页面,其中包含一些内容发布到服务器。 我已将文本内容发布到服务器,如下所示“ $.ajax({ url:”http://xxxx.xxx.xx/mobapp/api/save-data”, type:”POST”, crossDomain: true, dataType:”json”, data: {pliid: document.pliform.pliid.value,idate:document.pliform.date.value, snum:document.pliform.street_no.value, sname:document.pliform.street_name.value,state:document.pliform.state.value, pcode:document.pliform.PostCode.value, suburb:document.pliform.Suburb.value, productlist:pl}, success: function(data) { alert(“success”); console.log(JSON.stringify(data)); }, error: function(jqXHR, textStatus, errorThrown,data) { console.log(“readyState: ” + jqXHR.readyState); } 一切正常,但我想上传一些从设备上拍摄的图像,我没有任何关于上传多个图像的想法,因为我没有太多的经验将文件上传到api。 等你帮忙。 谢谢。

代码无法在Phonegap应用程序-Android上运行

我是跨平台开发的新手。 我有一段代码无法正常工作。 它在Logcat中提供3条Info消息。 第一条消息: “不支持Viewport target-densitydpi。”,来源:file:///android_asset/www/index.html(8) 第二条信息: “Uncaught SyntaxError:Unexpected token。”,source:file:///android_asset/www/css/jquery.mobile-1.3.2.css(17) 第三条信息: “未捕获的TypeError:无法调用null的querySelector方法”,来源:file:///android_asset/www/js/index.js(26) 代码在这里:` gcm on phonegap app.initialize(); // Java script code goes here Cordova Google Cloud Messaging Plugin Demo 任何帮助将不胜感激。谢谢。

当第二页应该可滚动时,iScroll 5不工作

我正在使用apache cordova 2.2 jquery 1.7.2 jquery mobile 1.4.3 iscroll 5 (Matteo Spinelli ~ http://cubiq.org/) 我有以下index.html: some buttons some buttons 我显示可滚动页面id =“thisshouldscroll”如下: $.mobile.changePage( “#thisshouldscroll”, { transition: “slideup”} ); buildScrollingData(); myScroll = new IScroll(‘#wrapper’, { mouseWheel: true, scrollbars: true }); 在其他地方,我已经定义: function displayScrollingData(){ var contentToAppend=””; //loop web service data add certain data to contentToAppend with contentToAppend = […]

如果移动到其他文件夹,手机间隙应用程序关闭

我正在应用手机间隙线-ova 2.7.0 Android操作系统,具有相机function和社交共享function。 在我的应用程序中,当我选择图像选择function。 然后它将我移动到gallery文件夹,当我按下后退按钮选择图片后回来时,我的应用程序停止。 我完全糊涂了。 我已经尝试过的事情: 相机事件function没有错误,因为如果我快速选择图片并返回应用程序。 然后它不会停止但是如果我浪费5秒来选择图片我的应用程序状态会丢失。 我尝试过暂停和恢复活动,但它没有帮助解决这个问题。 我检查了所有值。找不到null值! 需要注意的重要事项: 如果我在Twitter上分享我的消息并回到应用程序停止,社交function也会出现同样的问题。

如何将Click事件添加到PhoneGap中的动态列表视图?

我必须将click事件添加到动态列表视图中。 当我单击此列表时,它会重定向到更多详细信息页面。 我正在获取特定区域中可用的酒店列表并插入列表视图。 现在当我点击任何特定列表酒店重定向到更多详细信息页面。 查看可用酒店列表的以下图像列表视图。 每个酒店都有唯一的ID所以当我点击任何列表时,它将使用该唯一的酒店ID并从服务器获取该酒店的更多详细信息,并在该特定酒店的一个专用页面上显示。 我的问题是如何在动态列表视图中添加单击并传递该唯一的酒店ID,以便稍后我可以使用该酒店ID从服务器获取更多信息。 我的脚本代码,如何在动态列表中添加单击 $(document).ready(function(){ $(“#btnReg”).click(function(){ $(“#listHotelsOptions”).empty(); var distance = document.getElementById(‘distance_id’).value; var output=””; var hiddenId=””; $.ajax({ url:”http://192.168.1.4/Experiements/webservices/getHotels.php”, type:”GET”, dataType:”json”, data:{type:”login”, Distance:distance}, ContentType:”application/json”, success: function(response){ console.log(response) $.each(response, function(index,value){ hiddenId+=”+value.Hotel.Id+”; output+=’ ‘+value.Hotel.Name+’ has’+value.Hotel.Romms+”; }); $(“#listHotelsOption”).append(output).listview().listview(‘refresh’); }, error: function(err){ alert(JSON.stringify(err)); } }) //ajax }); //click }); //ready

持久jquery移动导航栏

我试图让持久的Jquery Mobile导航栏脚工作。 我希望它是用javascript(它是用于PhoneGap应用程序)动态绘制的,而不是使用PHP来模板页脚。 以下内容改编自: http : //the-jquerymobile-tutorial.org/jquery-mobile-tutorial-CH21.php 但是,jquery样式没有应用于第2页和第3页。就像$(“#navbar”)。navbar()没有为这些页面调用或过早调用。 任何人都可以帮我解决我可能出错的地方吗? 或者指向一个具有动态持久导航栏的代码示例,最好使用活动按钮持久性? 1 Window content 2 Window content 3 Window content var html = “”; html += “”; html += ” Footer part “; html += “”; html += “”; html += “Refresh”; html += “Help”; html += “Close”; html += “”; html += “”; html += […]

要求在jQuery Mobile上有一个隐形按钮是不是太过分了?

我挣扎了一段时间,所以我想把答案放在这里。 如何在jQM上有一个隐形按钮?

如何在jQuery Mobile中传递值?

在使用PhoneGap时,我创建了一个SQLite数据库,用于存储名称和电话号码以及自动增量ID字段。 我正在使用jQuery Mobile来获取结果并将其显示在listview中,这是代码 function queryDB(tx){ tx.executeSql(‘SELECT * FROM DEMO’,[],querySuccess,errorCB); } function querySuccess(tx,result){ $(‘#contactList’).empty(); $.each(result.rows,function(index){ var row = result.rows.item(index); $(‘#contactList’).append(”+row[‘name’]+’Phone ‘+row[‘phone’]+”); }); $(“#contactList”).listview(); } 现在我希望当用户点击屏幕上的某个列表元素时,他应该被带到一个新页面。 与此同时,我想将该用户的id传递给新页面,以便我可以使用该ID在DB中保存更多详细信息。 由于我是JQM的新手,我无法弄清楚如何做到这一点

ajax调用本地文件的麻烦?

我在Window Phone 7应用程序中使用了Phonegap.1.2.0.js。 所有与html5和javascripts相关的文件都在名为www的文件夹中。 我使用jquery $ .ajax({})进行ajax调用,该调用调用www文件夹中的.html文件(如同一个文件夹或本地文件),并出现错误“拒绝访问”。

带有phonegap和jquery mobile的$ .getScript和css问题

这是我的文件。 保留/www/js/index.js原样。 页面流应该是: app starts – > index.html – >从indexB.js加载MainPage.html – > MainPage.html但是所有的css都没有加载。 当我从index.html中删除’body onload =“init();”’并复制并过去MainPage.html到index.html的主体时,css没有问题。 由此,我检查了所有的css路线都是正确的。 /www/index.html /www/js/indexB.js var pagesHistory = []; var currentPage = {}; var path = “”; function init(){ $(“div[data-role=’page’]”).load(path + “pages/MainPage.html”, function(){ $.getScript(path + “js/MainPage.js”, function() { if (currentPage.init) { currentPage.init(); } }); }); } /www/pages/MainPage.html $.getScript(path + “js/MainPage.js”); Friends […]