Ajax progress & completed not firing.

0 favourites
  • 8 posts
From the Asset Store
Progress\Loading Bar. Now Load you game like a Professional.
  • 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?

  • 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.

  • 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)..

  • Try Construct 3

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

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

  • You do know contact is spelled wrong in event 2?

  • 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.

  • It happens..

    Glad I could help..

  • As a small form of payback for all the dumb questions I've gotten answered: scirra.com/tutorials/4887/tracking-your-users-with-ajax-php-and-mysql

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