Error 404 or Error 0 app

Asked

Viewed 35 times

-1

I’m trying to create an app using jquery, css, html and compiling via phonegap

When running via browser(http://www.petnetweb.online/shop/) appear the data, however, when compiling and running via app on android does not appear the value 0

I noticed that the Chrome console displays:

 Access to XMLHttpRequest at 'http://www.petnetweb.online/shop/gets/getdiversos.php' from origin 'http://localhost' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. 

I inserted the following below but did not solve

VER['HTTP_ORIGIN'] == "http://petnetweb.online/") {
    header('Access-Control-Allow-Origin: http://petnetweb.online/');
    header('Content-type: application/xml');
    readfile('arunerDotNetResource.xml');
}

Code that makes the query

<script>
var obj, dbParam, xmlhttp;
obj = { "table":"customers", "limit":20 };
dbParam = JSON.stringify(obj);
xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
    if (this.readyState == 4 && this.status == 200) {
        document.getElementById("getrecseupet").innerHTML = this.responseText;
    } else{document.getElementById("getrecseupet").innerHTML =this.status}
};
xmlhttp.open("GET", "http://www.petnetweb.online/shop/gets/getrecseupet.php" , true);
xmlhttp.send();

</script>

1 answer

-1

Browser other questions tagged

You are not signed in. Login or sign up in order to post.