AJAX Post Problem

Get help using Construct 2

Post » Thu Sep 13, 2012 9:07 pm

Try the php I had posted earlier and just change the variables around to meet your needs. I know it works because I use it on my server with construct2. If it works you'll have a good starting point that just needs the security stuff put in.
B
68
S
21
G
15
Posts: 701
Reputation: 15,604

Post » Thu Sep 13, 2012 9:13 pm

You can find an example of my working Ajax construct2 at the following link.
http://www.scirra.com/forum/what-am-i-doing-wrong-here_topic56751.html?KW=

Between the php example and the capx in the above link I'm hoping you can get yourself up and running. :)
B
68
S
21
G
15
Posts: 701
Reputation: 15,604

Post » Thu Sep 13, 2012 9:14 pm

Ps @ashley

I can't find documentation on the data field in Ajax requests. How does it work?
B
68
S
21
G
15
Posts: 701
Reputation: 15,604

Post » Thu Sep 13, 2012 9:38 pm

I think I know what's wrong. On the event sheet I have Button->On Clicked.
Instead I need to add the mouse plugin and have Mouse->left click on Button.

I've been clicking on the dang button expecting it to run the AJAX request but never added the mouse control to do so.

B
22
S
9
G
3
Posts: 202
Reputation: 3,645

Post » Thu Sep 13, 2012 9:47 pm

Disregard...that didn't work either. Having a look at your capx now.
B
22
S
9
G
3
Posts: 202
Reputation: 3,645


Post » Thu Sep 13, 2012 10:17 pm

That still seems like an awful lot of php for just updating one variable but I'm kind of new to it as well. Try posting the code On stackoverflow.com. They are usually very helpful as long as you are polite. Which I don't see a problem there for you. :)
B
68
S
21
G
15
Posts: 701
Reputation: 15,604

Post » Fri Sep 14, 2012 12:07 am

A couple of things:
Put "http://localhost/..." or else it will think it's a relative URL.
And the tags in the 'on progress', 'on completed' and 'on error' actions should all match the request tag ("Post Score").
B
54
S
28
G
18
Posts: 1,520
Reputation: 25,000

Post » Sat Sep 15, 2012 8:35 am

I think I have an idea of the root issue...the AJAX post, when it submits the data to the php page, does not maintain the session.

Ashley, is that possible?
B
22
S
9
G
3
Posts: 202
Reputation: 3,645

Post » Sat Sep 15, 2012 4:46 pm

Here are all the files:
https://www.dropbox.com/sh/w34mew65rymweg5/UyHw8LXmXI
B
22
S
9
G
3
Posts: 202
Reputation: 3,645

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 27 guests