0 Favourites

AJAX request not returning right value

  • I am in need of some help, any help is appreciated. I understand that PHP is beyond the scope of Construct 2, however I do know there are some experienced script programmers on these forums.

    What I have is a database named "test" and what im doing is sending an AJAX request from Construct 2 asking for a match between the text in FriendBox (which is a textbox in Construct 2) to my database and return the echoed result into a text plugin named FriendsText.

    However, I do have it all setup, and when I try to put something inside the FriendBox textbox and send the AJAX request to my PHP file, it returns "/ br" every time. I am not sure why it is returning that instead of returning the username from my database.

    Here is the screenshot where I declare an AJAX request inside Construct 2:

    <img src="http://img703.imageshack.us/img703/4387/fwhk.png" border="0" />

    And here is my PHP file that should return username:


    $username = $_GET['fname'];


    // Check connection

    if (mysqli_connect_errno())


    echo "Failed to connect to MySQL: " . mysqli_connect_error();


    $result = mysqli_query($con,"SELECT username FROM test WHERE username='".$username."");

    while($row = mysqli_fetch_array($result))


    echo $row['username'];




    This is the value that is returned when I run my program in Construct 2 over a public hosted server:

    <img src="http://img27.imageshack.us/img27/8505/546i.png" border="0" />

  • I got it- ill upload solution in a few.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • I got it- ill upload solution in a few.

    Could you post the solution please?

    I have the same problem :(

  • > I got it- ill upload solution in a few.

    Could you post the solution please?

    I have the same problem :(

    Solution for me was the following:

    I just had a typo writing the name of the table from which I had to retrieve data. If you try to call an unexisting table, you'll have </ br> as result.

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
378 33,278
part12studios's avatar
Unread sticky
150 20,746
Crow in the Snow's avatar
Crow in the Snow
Unread hot topic
0 Favourites
C3 Architect Request list
125 12,736
jayderyu's avatar