AJAX object problem

Discussion and feedback on Construct 2

Post » Tue May 06, 2014 9:00 am

Hi,

Im trying to sending data to server, it's very simple, only name and score. Im using AJAX object, and test it on localhost. But what happened is, its not working. It triggers onComplete event (for the AJAX) but the data never get into the database.

i've tried manually the url in the browser, and it's work. But in one condition, on the .php file, im using $_GET instead of $_POST. If im using $_POST, either way doesnt work. it comes and error saying something about undefined index: error..

Can someone give me hint about this problem and how to solve it ? Really appreciate it ! Thanks
B
6
S
1
Posts: 24
Reputation: 755

Post » Tue May 06, 2014 10:09 am

Is it blocked by CORS? Have you set up Access-Control-Allow-Origin as described by the AJAX manual entry?
Scirra Founder
B
399
S
236
G
89
Posts: 24,519
Reputation: 195,361

Post » Wed May 07, 2014 1:48 am

Hi Ashley,

Thank you for replying !

I'm not so sure about that. But anyway, somehow, now it works. But with one condition; i'm not using URLEncode when passing the data on construct. whenever i used urlencode, it always shown an error saying that the variables on the PHP is empty, sql query is empty.

Should i post something so to make it clear ?

i'm quite confused and worried even if its works now, because it doesnt use URLEncode.. i hope you can get a clue about it ashley :)
B
6
S
1
Posts: 24
Reputation: 755


Return to Construct 2 General

Who is online

Users browsing this forum: Google [Bot] and 8 guests