Reputation: 733
I have a strange problem with a Phonegap Android app.
I have a button with ontouchend='dosomeajax()'
.
If I execute the function through the remote inspector console everything goes well, but if I tap on the button, the function unexpectedly returns ajax error and it restarts(reloads the main html page).
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?
What's wrong?
Upvotes: 4
Views: 168
Reputation: 2149
Please show how you declare the button, if it is something like this:
<a href="#" ontouchend="dosomeajax()">click me</a>
it could be that the href
triggers the page reload. Just remove the href or make it href="javascript:false;"
or so.
Upvotes: 2