problem with ajax connections

0 favourites
  • 2 posts
  • good afternoon. my game through ajax communicates with the server. the server has an Access-Control-Allow-Origin policy: *

    I exported the project and checked it on the local server, it exchanges data with the remote server, everything works. I build a project for android-ajax does not work with the remote server. I checked it in the android studio, and got this error in the logs: "[Construct 3] AJAX request to 'http: // ********' (tag 'Check_connect') failed: "

    checked permissions by adding code like this:

    var permissions = cordova.plugins.permissions;
    permissions.checkPermission(permissions.INTERNET, function( status ){
     if ( status.hasPermission ) {
     console.log("Yes :D ");
     }
     else {
     console.warn("No :( ");
    	permissions.requestPermission(permissions.INTERNET, PremmSuccess, PremmError);
     }
    });
    function PremmError() {
    	//alert('NO');
    }
    
    function PremmSuccess( status ) {
    	if( !status.hasPermission ) PremmError();
    }

    I get "Yes: D" in the logs. What could be the problem?

    Tagged:

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • found the solution

    request from android means like request from https site.if your server use http protocol-that is the problem.just use https,and don't forget change http to https in ajax request.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)