Noob AJAX Question

0 favourites
  • 7 posts
  • Hey guys,

    So I've read the manual entry about enabling AJAX requests to be cross-domain, yet I'm still getting errors. So there's SOMETHING I'm missing... What I'm trying to do is to request local weather information based on IP geolocation. No matter what I do, my requests return "error". Any ideas what I might be missing? As I said, I read the manual entry, and thought I followed it as instructed, but I'm not getting a change in results. I'm feeling very noob at the moment, help?


  • Post php scripts and capx.

  • Can you provide some code in order to make an idea and come with a solution?

  • My code is like this:

    System | On Start of Layout: AJAX - Request " api key)" (tag "Location")

    AJAX | On "Location" Progress : Text | Set text to "Working"

    AJAX | On "Location" Error : Text | Set text to "Error"

    AJAX | On "Location" Completed: Text | Set text to "Completed"

    this always returns "Error"

    according to the manual if I add "Access-Control-Allow-Origin: *" then it is supposed to allow cross-domain requests, but I can't seem to make it work, it just keeps returning "Error" in my Text field...

  • Sorry to bump guys, I'm still stuck and not making any headway at all, there's clearly something obvious I'm missing :S

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Please any dev answer this... Please make a tutorial teaching how to configure construct or the webserver to allow crossdomain. There are a lot of people asking the same question and the manuals are totally vague on this subject.

    I configured my apache webserver to include Access-Control-Allow-Origin: * header and still not working. what to do next?

    We need more info!

  • Why don't you just use like Amazon Web Services free web servers (EC2), then you won't be making same origin calls.

    However, I did get the Same Origin calls working on my local development machine.

    Here are the relevant Apache settings:

    <Directory />

    AllowOverride None

    Options FollowSymLinks

    Header set Access-Control-Allow-Origin "*"


    DocumentRoot "D:/Apache HTTPD 2.4.3/htdocs"

    <Directory "D:/Apache HTTPD 2.4.3/htdocs">

    AllowOverride None


    However, I am only using Apache as a proxy gateway server, not the content delivery server. I run all requests through Apache back to a Tomcat serlvet container which feeds all game data.

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