Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Load page data XML through JS?
#1
I am making a trivia game with Get-Simple. I use it a lot for web development and recently someone approached me about making this game. The catch was, he wanted it ready to use for mobile. Instead of using Objective C and ...whatever the Droid language is, I decided to use HTML and the browsers which all phones have. The templates use a responsive CSS grid.

The reason this works with Get-Simple, imo, is because you can use the custom field plugin and add your multiple choice answers and use the standard content editor as the question field.

So I've gotten to the point where I need to load the questions via Ajax because I don't want the page to refresh every time.

In my php I store the url to data/pages like so:
$gamePath = GSDATAPAGESPATH;

After my Ajax funtion calls the xml from data/pages/, this throws a 403 forbidden error on /data/pages/*.xml

document.getElementById("currentQuestion").innerHTML=newQuestion;

/* ... */

newQuestionPage.open("GET",document.questionPath+"2.xml",true);

I looked at the Pajax plugin, but I didnt see any easy way to request more fields so I didn't try to modify it. Is this an .htaccess issue?

trivia.mulhollandweb.com/questions/1

Its not structured perfectly yet. I need to modify the way pages are stored, if possible. For now, I am just creating all the questions as pages named 1, 2, 3, etc.

Can I use Ajax to get at that content? Or should it be done through PHP?
Reply
#2
The htaccess file blocks xml
you will have to use either the api, i do not know the state of it though.

Or add your own htaccess file to allow direct xml access.

Your best bet is to probably use a php file in your template and have it fetch your xml or json it to the browser.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply




Users browsing this thread: 1 Guest(s)