admin管理员组文章数量:1431435
I am developing an application in android using cordova and angularjs (onsenui front end framework). Here is my get request to fetch some data from server
$http.get(url+"getlotterylist").then(function(msg){
$scope.loading=false;
$scope.items=msg.data;
},
function(err){
alert("error"+JSON.stringify(err));
console.log("Error"+JSON.stringify(err));
}
);
CASE 1
When running app in browser i will get the desired output (get request works fine).
CASE 2
Build my app in android platform and import to android studio. At this point the http get request returns the following error
{"data":"","status":404,"config":{"method":"GET","transformRequest":[null],"transformResponse":[null],"url":"","headers":{"Accept":"application/json, text/plain, /"}},"statusText":"Not Found"}"
Also enabled CORS in my php
<?php
header("Access-Control-Allow-Origin: *");
//api request response
?>
Why i am getting this error when running my app in phone?
I am developing an application in android using cordova and angularjs (onsenui front end framework). Here is my get request to fetch some data from server
$http.get(url+"getlotterylist").then(function(msg){
$scope.loading=false;
$scope.items=msg.data;
},
function(err){
alert("error"+JSON.stringify(err));
console.log("Error"+JSON.stringify(err));
}
);
CASE 1
When running app in browser i will get the desired output (get request works fine).
CASE 2
Build my app in android platform and import to android studio. At this point the http get request returns the following error
{"data":"","status":404,"config":{"method":"GET","transformRequest":[null],"transformResponse":[null],"url":"http://example.?action=getlotterylist","headers":{"Accept":"application/json, text/plain, /"}},"statusText":"Not Found"}"
Also enabled CORS in my php
<?php
header("Access-Control-Allow-Origin: *");
//api request response
?>
Why i am getting this error when running my app in phone?
Share Improve this question edited Jul 20, 2015 at 6:45 shamon shamsudeen asked Jul 20, 2015 at 6:28 shamon shamsudeenshamon shamsudeen 5,87820 gold badges74 silver badges144 bronze badges1 Answer
Reset to default 8Installing Cordova white-list plugin solves my problem
https://github./apache/cordova-plugin-whitelist
本文标签: javascriptCordova android Getting 404 error in angular js appStack Overflow
版权声明:本文标题:javascript - Cordova android: Getting 404 error in angular js app - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745480567a2660153.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论