I\'ve been trying to import an XML document into HTML without using a server. I\'m working with standalone computers so I can\'t upload it to any server, which means I can\'t us
One option would be to include the question file as JavaScript content (still in a separate file) instead.
If the content is really simple (eg just a list) then your file could just be a simple array.
var questions = [
"What time is it?",
"Is the sky blue?",
"What do you call a fish with no legs?"
];
You just include this file in your page with a script tag:
If your question structure is more complicated you can include it in a JSON format that allows for complex nesting etc.
var questions = [
{
"id":1,
"question":"What time is it?",
"datatype":"text"
},
{
"id":2,
"question":"Is the sky blue?",
"datatype":"boolean"
},
{
"id":3,
"question":"What do you call a fish with no legs?",
"datatype":"text"
}
];
Either way once the question data is loaded into memory you can randomize the questions and decide which ones to render.