Noob AJAX Question

Get help using Construct 2

Post » Thu Sep 27, 2012 9:56 am

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
B
64
S
8
G
9
Posts: 290
Reputation: 8,590

Post » Thu Sep 27, 2012 8:30 pm

Post php scripts and capx.
B
22
S
9
G
3
Posts: 202
Reputation: 3,645

Post » Thu Sep 27, 2012 9:21 pm

Can you provide some code in order to make an idea and come with a solution?
B
15
S
3
G
2
Posts: 42
Reputation: 2,412

Post » Fri Sep 28, 2012 6:37 am

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...
B
64
S
8
G
9
Posts: 290
Reputation: 8,590

Post » Fri Oct 05, 2012 3:42 am

Sorry to bump guys, I'm still stuck and not making any headway at all, there's clearly something obvious I'm missing :S
B
64
S
8
G
9
Posts: 290
Reputation: 8,590

Post » Wed Apr 03, 2013 5:00 pm

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!
B
1
Posts: 2
Reputation: 254

Post » Wed Oct 15, 2014 6:44 pm

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.
https://www.ravenheart.ca/home
Company name changed to avoid Facebook-type shenanigans

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
17
S
5
G
1
Posts: 1,119
Reputation: 3,991


Return to How do I....?

Who is online

Users browsing this forum: austinblackbelt and 32 guests