I have this working PhoneGap application built with AngularJS and Onsen UI, that accesses a PHP file where it gets some data in the response. The php file was on a domain with simple http, but now that I moved it to one that supports https , I keep bumping into some weird problems.
I tried the AngularJS async way of getting data, and also an ajax call.
$http.get('https://blablabla.com/file.php?parameters').then(function(response) {
//SUCCESS
alert(response);
var z = response;
},function(response) {
alert("Failed");
});
It goes to the SUCCESS part, but the data that I have in it is incorrect. It should be a string (a plain JSON string, that I will stringify and convert to a json object)
The ajax call is the following:
function httpGet(theUrl) {
var dataToReturn;
$.ajax({
type: 'GET',
url: theUrl,
cache: false,
async: false,
data: "",
success: function(data, textStatus, result) {
dataToReturn = data;
},
error: function (result, textStatus, errorThrown) {
alert("Failed to get response from server!");
}
});
return dataToReturn;
//var xmlHttp = new XMLHttpRequest();
//xmlHttp.open( "GET", theUrl, false ); // false for synchronous request
//xmlHttp.send( null );
//return xmlHttp.responseText;
};
I'm basically calling a php script that is in https, from a PhoneGap app. If I change the address to http, it works flawlessly...
I also want you to note, that PhoneGap basically creates some sort of local proxy. I'm not really sure how to elaborate on this, though...
Any ideas on how to solve this, to get the same data as I would when the addresses are simple "http"?