The "xml example" with ajax

Get help using Construct 2

Post » Fri Jan 10, 2014 10:56 am

Hi
I'm going to need to pull some text from a xml stored under files. I never used xml and ajax with construct before, so I figured it would be a good idea to start simple. I'm glad i did course I got problems almost immediately.

Here's what i did: I took the Example xml file that comes with construct saved the xml to a file and tried to load it with ajax. I thought this would be straight forward and work on the fly, But no.
I read lots of threads and the manual but I still can't figure this one out. So I now come to you for some clarification, please.

!Working!
Here's the CapxMonumental2014-01-10 14:56:50
My game Petrolhead Tactics is now on Steam Greenlight. I could not have done this without C2 ? Please rate, if you like!

Steam client already open: petrolheadtactics.com/steam
Web: petrolheadtactics.com/greenlight
B
20
S
4
G
4
Posts: 132
Reputation: 4,130

Post » Fri Jan 10, 2014 12:30 pm

It's because the bookstore.xml is not well formed. You have double quotes everywhere in the file. Just search and replace with single quotes and it works, i.e.

change <book category=""COOKING"">
to <book category="COOKING">
If your vision so exceeds your ability, then look to something closer.
Moderator
B
134
S
30
G
84
Posts: 5,387
Reputation: 58,456

Post » Fri Jan 10, 2014 1:04 pm

I made the changes. However it seems to be that ajax won't work in local view. So that's probably it. If anyone can confirm that's the case please do. I will leave the cpax for the time being, but will upload a working one when it's done. Thanks for the response!
My game Petrolhead Tactics is now on Steam Greenlight. I could not have done this without C2 ? Please rate, if you like!

Steam client already open: petrolheadtactics.com/steam
Web: petrolheadtactics.com/greenlight
B
20
S
4
G
4
Posts: 132
Reputation: 4,130

Post » Fri Jan 10, 2014 1:21 pm

What do mean by local? No html5 export can be ran locally due to browser restrictions, and must always be hosted in either your own web server, or offsite in places such as Dropbox.

Here is the .capx that works for me: https://dl.dropboxusercontent.com/u/34306693/xmlajaxexample.capx

and here is it working from DropBox:

https://dl.dropboxusercontent.com/u/34306693/xmlajax/index.htmlzenox982014-01-10 13:21:28
If your vision so exceeds your ability, then look to something closer.
Moderator
B
134
S
30
G
84
Posts: 5,387
Reputation: 58,456

Post » Fri Jan 10, 2014 2:10 pm

I were reading this and started thinking that is was due to some web server magic, not my inability =P

!Capx updated!

Live long and prosper, zenox98!
My game Petrolhead Tactics is now on Steam Greenlight. I could not have done this without C2 ? Please rate, if you like!

Steam client already open: petrolheadtactics.com/steam
Web: petrolheadtactics.com/greenlight
B
20
S
4
G
4
Posts: 132
Reputation: 4,130


Return to How do I....?

Who is online

Users browsing this forum: David181, jorgmaquoi, unicornspitfire, Yahoo [Bot] and 21 guests