J
J
Juster2015-05-29 10:12:07
JavaScript
Juster, 2015-05-29 10:12:07

How to make a cross domain http request in Cordova/Ionic Framework on Android?

How to make a cross domain http request in Cordova/Ionic Framework on Android?
I tried to set up proxying in ionic.project, it doesn't help. This is how I make the request:

$http.get('http://localhost:8100/getnews/?hashcode=' + hashcode + '').then(function (resp) {
        ...
    }, function (err) {
        ...
    }

This is how the proxy is configured in ionic.project:
{
  "name": "...",
  "app_id": "...",
  "proxies": [
      {
        "path": "/getnews",
        "proxyUrl": "http://yukigaru.pythonanywhere.com/getnews/"
      }
    ]
}

Such a request is not executed, the function (err) branch is triggered.
Cordova 5.0.0, Ionic 1.3.20, Android 5.x.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
_
_ _, 2015-05-29
@AMar4enko

Where are you trying it, on the device or in the browser? ionic serve with --live?

J
Juster, 2015-05-31
@Juster

I build like this: cordova build --release android.
I also tried debugging.
It works in a browser on one machine, but not on another, I don’t know what it depends on.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question