Issue
I have a problem, i can't access to an api i created in my localhost with genymotion. The api link works fine in the android browser but when i use it in $http.get it doesn't work, i tried logging the error message but it returns null. Here's my code:
$http.get('http://10.0.3.2:80/api/user')
.success(function(json) {
console.log(json);
deferred.resolve(json);
})
.error(function(error) {
console.log("Error: "+error);
deferred.reject();
})
The console show: "Error: null"
Solution
I found a solution, the problem was not in genymotion or in my code but actually in the local server, i had to enable CORS (you can find how to enable cors in wamp here)
I also had this problem with my remote server so i have to enable CORS there also.
Answered By - aaa
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.