How do I use Ajax to get *new* values from XML

0 favourites
  • 7 posts
From the Asset Store
Create your game with this complete pack of images and animations!
  • I have an XML file which is updated at 4Hz with values from an external process. I have included this xml file into my project, and am attempting to show the constantly updating values in a text box. I have created a System object and set it to load the xml file twice per second, using the AJAX plugin. I then set up text boxes to display the XML values, using Ajax -> on XML completed. But the text boxes only show the initial value, and are not being updated with the subseqent values. What am I missing?

  • It could be that the XML file you update is not the same as the XML file in the project. What is this the update process looking like ?

  • The xml file is being rewritten by an exe, which is picking up input from a hardware device. There is only one xml file of that name, which has been added to the project. I know it's seeing it because it's showing the initial value

    event sheet image here: westernpath.com/maystaff/xml.png

    Thanks for your input

  • Everything seems in order, it might be a caching problem client-side. Could you try adding a random parameter in your AJAX request? It would fool the caching mechanism into believing they are distinct request and actually execute them every time.

  • I wondered about cache. I'm new to Construct 2, how would I best achieve adding a random parameter? There's also cache: false you can use in jQuery, but I'm not sure how I'd implement it here

  • Don't use "request project file" and simply use the filename as the URL and add a query string to it. If using a post request, put the query string in the "data" box instead. Can't test it right now but it should work.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Missing link is to add AJAX -> On ANT completed -> System -> Reset persisted objects on event sheet. Not sure what this will do to other objects, but will post any updates. Thanks for the pointers Magistross!

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