AJAX Request trouble

0 favourites
  • 4 posts
  • Hi, I'm new to Construct 2 (I've been using it for three days) and I'm having trouble with AJAX.

    I am hoping to make a call to a URL to access an XML file, as this XML will be updated regularly using a web interface and PHP/HTML form, the XML file needs to be accessed using the AJAX request instead of loading it as a string.

    I'm having trouble as it appears that the AJAX request is not completing. So far my file looks something like this:

    System> On Start of layout> AJAX> Request "URL" (tag"xml")

    AJAX> on "xml" completed > XML> Load XML document from string AJAX.LastData > set text to "click here"

    Mouse> on any click> Text> Set text to XML.StringValue("/game")

    I'm using Xampp to preview and I have been exporting the project file to htdocs and then testing and on click the text changes to /game however it does not at any point change to Click Here which suggests to me that the AJAX request is not completing.

    Any advice for a newb? Thank You in advance.

    p.s. please forgive me if this is in the wrong area on the forum.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Copy the url of your Ajax Request into the browser bar and click go. If it returns your xml data then the issue is not your Ajax request but how the Ajax.LastData is being handled client side.

  • When I access the HTML using the URL in my browser it displays correctly and I have tested AJAX requests using PHP to display text and it worked just fine. I also loaded the XML as a string and it works fine.

    However like I said due to the constant updates this XML will have it cannot be loaded as a string. Is there something I am missing with my xampp set up that could be causing this problem?

  • Post your capx and xml file please.

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