Ajax progress & completed not firing.

Get help using Construct 2

Post » Thu Nov 26, 2015 6:51 pm

I'm sending data to a php file via the Ajax Request. I'm formatting the URL as if it were a GET request. The .php file is receiving the data and processing it. But, the Ajax plugin doesn't seem to be getting the on progress or on completed. I've checked, the tags match. Before I added in the header('Access-Control-Allow-Origin: *'); the on error was firing.

Is there something I need to put into my .php file to let the Ajax plugin know it's done?
B
15
S
5
Posts: 124
Reputation: 1,687

Post » Fri Nov 27, 2015 3:26 pm

I've done a bit more testing. I set the System every x seconds to check and see if there was any Ajax.LastData. And, the .php script is sending data back to the Ajax Plugin as the LastData is exactly what I'm echo'ing out of the php script. But the Ajax plugin is still not detecting an on Completed or on Progress event. I've tried changing the headers on the .php file and nothing.

So, data is flowing back and forth, the Ajax plugin simply can't tell if it's done or not.

I'll take ANY ideas at this point.

Since the IAP isn't working with Chrome Web I'm having to look at PayPal integration and in order to check registrations, I'm gonna need to run a .php script. Since there is no simple GET or POST with C2 and since the browser opens everything in another window, Ajax is my only hope.

If I do succeed, I'll post instruction on how I managed this.
B
15
S
5
Posts: 124
Reputation: 1,687

Post » Fri Nov 27, 2015 3:50 pm

Could you show an example on how your events are set up?
Might be a very simple thing, (especially since you are saying ajax.lastdata exists)..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Fri Nov 27, 2015 4:04 pm

I certainly can (I've replace the URL's though with fake ones). Here's a description of what it does. 2 buttons, 2 Text plugins. One button sends an Ajax post and the other sends and Ajax request formed into a GET (I'm testing both). When a button is clicked, it contacts the .php file. The php file reads the GET or POST and simply echoes the word "Finished." In theory, Text2 should contain the word "Done" when the Ajax event is completed or "Working" when it's in progress. Text2 should be updated when the onProgress and onCompleted events fire. The system timer event I added to see if the Ajax plugin was actually getting data back since the events weren't firing.

The Text does filled with the "Finished" from the Ajax.LastData but only when the timer fires and checks it. So I know it's sending and receiving data, it's just not firing off the completed or progress events.

Image
Last edited by Fengist on Fri Nov 27, 2015 4:09 pm, edited 1 time in total.
B
15
S
5
Posts: 124
Reputation: 1,687

Post » Fri Nov 27, 2015 4:08 pm

You do know contact is spelled wrong in event 2?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Fri Nov 27, 2015 4:10 pm

omg, I'm an ijut. It works. You have no idea how many hours I've spent googling and reworking the .php files over a typo. Thanks LittleStain. Proof another pair of eyes are sometimes needed.
B
15
S
5
Posts: 124
Reputation: 1,687

Post » Fri Nov 27, 2015 4:21 pm

It happens..
Glad I could help..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Fri Nov 27, 2015 7:59 pm

Message: Fengist can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
As a small form of payback for all the dumb questions I've gotten answered: https://www.scirra.com/tutorials/4887/tracking-your-users-with-ajax-php-and-mysql
B
15
S
5
Posts: 124
Reputation: 1,687


Return to How do I....?

Who is online

Users browsing this forum: AllanR, BackendFreak, brunopalermo, farsen, ST314 and 37 guests