AJAX Request trouble

Get help using Construct 2

Post » Thu Jan 10, 2013 11:42 am

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.
B
2
Posts: 3
Reputation: 431

Post » Fri Jan 11, 2013 3:26 am

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.
B
22
S
9
G
3
Posts: 203
Reputation: 3,647

Post » Fri Jan 11, 2013 4:52 pm

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? Dinita2013-01-11 16:53:31
B
2
Posts: 3
Reputation: 431

Post » Sat Jan 12, 2013 5:33 am

Post your capx and xml file please.
B
22
S
9
G
3
Posts: 203
Reputation: 3,647


Return to How do I....?

Who is online

Users browsing this forum: Callan S, farfetchd83 and 16 guests