0 Favourites

Noob AJAX Question

  • 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?

    Brent

  • Post php scripts and capx.

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

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • My code is like this:

    System | On Start of Layout: AJAX - Request "http://api.ipinfodb.com/v3/ip-city/?key=(my 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

  • 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 "*"

    </Directory>

    DocumentRoot "D:/Apache HTTPD 2.4.3/htdocs"

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

    AllowOverride None

    </Directory>

    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)
Similar Topics Posts Views Last Post
Unread hot topic
353 32,093
yojona's avatar
yojona
Unread sticky
192 1,337,434
Kyatric's avatar
Kyatric Construct Team Support
Unread hot topic
0 Favourites
Noob & Screen sizes
43 8,190
LolindirLink's avatar
LolindirLink