How do I get data from AJAX?

0 favourites
  • 3 posts
From the Asset Store
Data+ is the best Data Management solution for Construct 3. It contains 4 Addons (Plugin & Behavior).
  • Hello!

    I have set up my php file like this:

    <?php
    header("Access-Control-Allow-Origin: *");
    $latest = 2;
    $check = $_GET['ver'];
    
    if ($check == $latest) 
    {
    	echo "666";
    }
    elseif ($check < $latest) 
    {
    	$file = fopen("database.txt", "r");
    	echo fread($file,filesize("database.txt"));
    	fclose($file);
    }
    else
    {
     echo "555";
    }

    And my events are like this, but when i click on the button i get nothing, no response.

    I have checked this url with my browser and i get expected response, but for some reason it's not working inside Construct. What am i doing wrong?

  • it is not happy with "http://..."

    change that to "https://..." and it works fine with you php script.

    "https://www.zvornik24.info/potd/update.php?ver=2"

    without the "s" it was showing an error in the preview window, up in the top right corner - if you click on that and gave it permission to access unsafe scripts, it then started working.

    but with the "s" it works every time.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks mate!!! It works now!

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