help me... AJAX no return data!!!

Get help using Construct 2

Post » Tue Jul 29, 2014 4:37 pm

tutorial example why it does not return the loaddata ? where am I wrong?
tnks?
You do not have the required permissions to view the files attached to this post.
B
8
S
1
Posts: 3
Reputation: 956

Post » Tue Jul 29, 2014 4:57 pm

If your running your capx in preview mode and not from the same the server the AJAX file is loaded on then your server will by default ignore the ajax request. Its a security function of php to prevent outside connections from accessing any data you don't want them to. On your AJAX file you need to add a header call to allow access from out side connections.

Code: Select all
<?php header('Access-Control-Allow-Origin: *'); ?>


How ever you need to do more reading on this subject as this line above will open up your server to to all outside requests. Its dangerous to leave it in place as is but for testing this should fix your problem
B
20
S
7
G
1
Posts: 221
Reputation: 2,077

Post » Tue Jul 29, 2014 5:43 pm

I try immediately ... thanks
B
8
S
1
Posts: 3
Reputation: 956

Post » Tue Jul 29, 2014 5:46 pm

thanks so much it works :)
B
8
S
1
Posts: 3
Reputation: 956

Post » Fri Aug 01, 2014 12:26 pm

Hi! I tried to use AJAX to load a local text/config file (node webkit export) but it returns no data (only a 404 not found error) if it runs in node webkit preview mode.
When I export it it works. Is it possible to fix/change this somehow?

Example:
Image
Bl4ckSh33p-Soft - Custom Software and Indie Games
B
58
S
18
G
6
Posts: 756
Reputation: 9,591

Post » Fri Aug 01, 2014 1:44 pm

From manual, this might apply to your situation :
Note that previewing with node-webkit runs node-webkit directly from the Construct 2 install directory. As a consequence, the AppFolder expression will return <install path>\exporters\html5\node-webkit\win32. If this poses a problem for you, use the following workaround: have a global string variable; if 'Is in preview' is true hard-code it to some development folder somewhere else, otherwise set it to NodeWebkit.AppFolder. Then use the global variable instead of the AppFolder expression.
B
75
S
31
G
27
Posts: 1,015
Reputation: 20,765

Post » Fri Aug 01, 2014 2:29 pm

Oops. Thanks, I missed that one.
I usually have the manual open everytime I open Construct. :)
Bl4ckSh33p-Soft - Custom Software and Indie Games
B
58
S
18
G
6
Posts: 756
Reputation: 9,591


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 5 guests