Ajax Request Works On Browser But Not On Android Device
I am making a simple mobile app with Cordova. The code I have works perfectly when I test it in a browser but it ignores the success function when test on an Android phone and prin
Solution 1:
Have you tried putting your code inside deviceready? Suppose your html starting index file look likes below,
<html>
<head> </head>
<body onload="onBodyLoad()" >
</body>
</html>
and your script file look likes below.
<script>
function onBodyLoad() {
document.addEventListener("deviceready", onDeviceReady, false);
}
function onDeviceReady() {
// do your thing here!
}
</script>
Solution 2:
I made it work by building a new project with Phonegap (instead of Cordova). Exactly the same code otherwise. Still no idea why it wouldn't work with Cordova.
Post a Comment for "Ajax Request Works On Browser But Not On Android Device"