Making Ajax calls

Hi there,

I’m trying to do something that should be quite basic regarding the ionic/cordova mechanism, making http requests from my Android device.
It is just failed whatever I’ve tried…I guess due to the CORS.

I’ve got all the required permissions in the config.xml file and in the AndroidManifest.xml file.

I’ve set up a proxy thanks to ionic CLI in the ionic.config.json file.
“proxies”: [{
“path”: “/api/login”,
“proxyUrl”: “http://my-example.api.com
}]

I’m using the Angular $http to make my requests.
$http({
method : “POST”,
data : JSON.stringify(loginData),
dataType: ‘json’,
contentType: ‘text/plain’,
crossDomain: true,
url : “/api/login”,
}).then(function mySucces(response) {
alert(‘SUCCESS’);
}, function myError(data) {
alert(“FAIL”);
});

I’ve tried various header in the index.html…here’s the latest

I’m running out of ideas.
For info, I don’t have access to the Server API to make any changes.

Am I missing something ? Am I doing anything wrong ?

Thx

Dear,

You should try ionic provider services instead of jquery.

Are you using ionic 2 or 1?

Ionic, v1.2.4 as I can read

Maybe a weird answer but would I be using jQuery without knowing it ?
I haven’t referenced any files.