Phonegap应用程序意外重启

时间:2014-06-24 11:22:34

标签: android ajax cordova

我对Phonegap Android应用程序有一个奇怪的问题。 我有一个ontouchend='dosomeajax()'的按钮。

如果我通过远程检查器控制台执行该功能一切顺利,但如果我点击该按钮,该功能意外返回ajax错误并重新启动(重新加载主html页面)。

D/com.appgyver.preview.ESWebViewClient( 3632): shouldInterceptRequest: http://myserver.com/action.php
D/com.appgyver.preview.ESWebViewClient( 3632): onLoadResource: http://debug.phonegap.com/ws/target/112xxxxx4
D/com.appgyver.preview.ESWebViewClient( 3632): onLoadResource: http://myserver.com/action.php
D/com.appgyver.preview.ESWebViewClient( 3632): shouldOverrideUrlLoading: http://localhost/index.html, http://localhost/index.html?
D/com.appgyver.preview.ESWebViewClient( 3632): Overriding url loading for http://localhost/index.html?

出了什么问题?

1 个答案:

答案 0 :(得分:2)

请说明如何声明按钮,如果是这样的话:

<a href="#" ontouchend="dosomeajax()">click me</a>

可能是href触发了网页重新加载。只需删除href或将其设为href="javascript:false;"左右。

相关问题