No ajax response

Get help using Construct 2

Post » Wed Jul 17, 2013 11:13 am

Hi all,
Lately I've been having problems with ajax requests,
After the ajax request does not return anything.
the request is to introduce some data in my database,
in the .php file I put this "header (' Access-Control-Allow-Origin: * ');"
but after the query in php, construct 2 does not read the printed result on the web page
Please help me

the .php file here :
https://www.dropbox.com/s/lktoxasd7hgcsrz/registrazione.php
the .capx file here :
https://dl.dropboxusercontent.com/s/hxxa7cvuzkssjns/ajax.capx?token_hash=AAHtm_Emd2x2q3QVEDtWYuywGfBM9bc33gzKXl_ocRWCjQ&dl=1
beppemar2013-07-17 11:16:36
B
2
Posts: 3
Reputation: 181

Post » Wed Jul 17, 2013 11:51 am

To locate your problem, you may want to start by looking if the AJAX request is done, or if any problem appends during the request. What does the console give you on the request ? Aborted ? Cross-origin problem ?
You could also use the "on error" event in C2 to check if the request goes ok or not.
I tried the same thing you did on a userscript (cross domain AJAX, displaying the return) and had to change my way of allowing cross origin depending on the server I used. This may be also your case, not all servers allow the use of this header, some will make you use an htaccess instead.
B
17
S
8
G
4
Posts: 461
Reputation: 6,097

Post » Wed Jul 17, 2013 2:40 pm

Maybe should delete all html, head and body tags and add the word "php" after <? sign. Also check if the place where you are hosting your MySQL database allows remote access, this might be your main problem here.
I am using freemysqldatabase.com, which allows remote access.
Here is my php file if you are interested:
https://dl.dropboxusercontent.com/u/148544823/save.php
B
14
S
5
G
4
Posts: 107
Reputation: 4,788

Post » Wed Jul 17, 2013 6:24 pm

[QUOTE=trollface] Maybe should delete all html, head and body tags and add the word "php" after <? sign. Also check if the place where you are hosting your MySQL database allows remote access, this might be your main problem here.
I am using freemysqldatabase.com, which allows remote access.
Here is my php file if you are interested:
https://dl.dropboxusercontent.com/u/148544823/save.php[/QUOTE]
trollface I love You . Ok now Work , thanks.
You have save me , i'm going to sucide .
bye
B
2
Posts: 3
Reputation: 181


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 2 guests