IOS build works on my iPad but is rejected by App-store because Ajax calls doesn't works
-
Hi!
First screen on my App is a login screen.
The App is working totally and perfectly with my builds in Android and IOS (on my ipad 13.6.1 installing the App from TestFlight !!)
But when I send the App to review to App-Store it is always rejected because after input user/pass, the App doesn’t get response from my backend server when I send tha ajax call to check user vality.
This is my content-secutity-policy tag in index.html:
<meta http-equiv=“Content-Security-Policy” content=“default-src * data: gap: content: https://ssl.gstatic.com; style-src * ‘unsafe-inline’; script-src * ‘unsafe-inline’ ‘unsafe-eval’; connect-src *”>
This is my code for the ajax call:
var dades=“email=”+v_email+"&password="+v_password+"&osid="+v_osid;
document.getElementById(“loader”).style.display=“block”; // display the spinner
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
resultat=this.responseText;
document.getElementById(“loader”).style.display=“none”; //
if(resultat==“OK”){
document.getElementById(“scr_menu”).style.display=“block”;
scr_activa=“scr_menu”;
opcio(“chat”);
} else {
document.getElementById(“scr_login”).style.display=“block”;
message_app(“User/password Incorrect”);
scr_activa=“scr_login”;
}
};
};
xhttp.open(“POST”, “https://clicselva.cat/ajax-app/check_login.php”, true);
xhttp.setRequestHeader(“Content-type”, “application/x-www-form-urlencoded”);
xhttp.send(dades);This is my .htaccess file in my backend server to return CORS headers
Header set Access-Control-Allow-Origin “*”
Can someone help-me whit this issue?
Really I’m going crazy!
Thanks in advance!
-
@jaumemorera I also want to do ajax call same as below but not working in onsen ui. Please guide me you know.
var person = {} person["ContactNo"] = "9428299999"; person["Pwd"] = "123"; alert(JSON.stringify(person)); $.ajax({ url: "http://voting.somee.com/api/AjaxAPI/LoginAuth", type: 'post', dataType: 'json', //contentType: 'application/json', data: person, success: function (data) { var myJSON = JSON.stringify(data); alert(myJSON); }, error: function (response) { alert(response.responseText); } });