No ajax response

0 favourites
  • 4 posts
  • 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 <img src="smileys/smiley6.gif" border="0" align="middle" />

    the .php file here :

    dropbox.com/s/lktoxasd7hgcsrz/registrazione.php

    the .capx file here :

    dl.dropboxusercontent.com/s/hxxa7cvuzkssjns/ajax.capx

    <img src="smileys/smiley19.gif" border="0" align="middle" />

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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

  • 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

    trollface I love You . Ok now Work , thanks.

    You have save me , i'm going to sucide .

    bye

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