服务器端响应不会显示在 PhoneGap 中 + jQuery 移动应用程序
我有一个相当简单的 jQuery 移动应用程序,它作为一个 Web 应用程序运行良好(在台式机/智能手机上的浏览器中进行了测试),但是当使用phonegap 将其移植到 android 时,我遇到了一个主要问题。它既发生在真实手机上,也发生在 AVD 中。
应用程序中有一个表单,例如:
<div data-theme="a" data-role="dialog" id="a-form">
<div data-role="content">
<h3>...</h3>
<form action="http://a-live-site.com/a-form.php" method="post">
...
<div data-role="fieldcontain">
<button type="submit">Submit</button>
</div>
</form>
</div>
</div>
它的响应内容在浏览器中完美加载(action
是那里的相对链接),但在phonegap中我只是得到一个白屏,并且硬件后退按钮退出应用程序而不是通常的历史倒退。令人费解的是,请求居然通过了。服务器端代码触发电子邮件,因此我知道服务器正在收到请求。我已在 phonegap.xml
文件中添加了适当的
规则,但我不确定这是否足够。
编辑:表单是静态内容,因此在phonegap中,它由 file://
加载,不应该有跨域问题。
I have a fairly simple jQuery mobile app, which works fine as a web app (tested in browsers on desktops/smartphones) but when porting it to android using phonegap, I have one major issue. It occurs both on a real phone and in an AVD.
there's a form in the app, like:
<div data-theme="a" data-role="dialog" id="a-form">
<div data-role="content">
<h3>...</h3>
<form action="http://a-live-site.com/a-form.php" method="post">
...
<div data-role="fieldcontain">
<button type="submit">Submit</button>
</div>
</form>
</div>
</div>
Its response content loads perfectly in the browser (the action
is a relative link there), but within phonegap I just get a white screen and the hardware back button exits the app instead of the usual step back in history. The puzzling thing is that the request actually gets through. The server side code triggers an email, so I know the server is getting the request. I have added the appropriate <access />
rules in the phonegap.xml
file, but I'm not sure that's enough.
EDIT: the form is in static content so, in phonegap, it's loaded by file://
and shouldn't have cross-domain issues.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该问题是由于结果中的
data-role="dialog"
造成的。使用page
修复了它。它只是在phonegap 中损坏,而phonegap 的日志使它看起来像是其他东西。真正的皮塔饼。The problem was due to
data-role="dialog"
in the result. Usingpage
fixed it. It only broke in phonegap and phonegap's logs made it look like it was something else. A real PITA.