1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| function getText(num) {
this.num = num;
var self= this;
dojo.xhrGet({
url: "quizz.json",
handleAs: "json",
sync: true,
load: function(responseObject, ioArgs){
self.data = responseObject;
/*var question = dojo.doc.createTextNode(responseObject.poll.question[self.num].value);
dojo.body().appendChild(question);
dojo.body().appendChild(document.createElement('br'));
for(var i=0; i<responseObject.poll.question[self.num].answer.length;i++) {
var answer = responseObject.poll.question[self.num].answer[i].value;
var type = responseObject.poll.question[self.num].type;
var nbAnswers = responseObject.poll.question[self.num].answer.length;
applyQuestionType(i, answer, type, nbAnswers);
dojo.body().appendChild(document.createElement('br'));
}
dojo.body().appendChild(document.createElement('br'));
*/
return responseObject;
},
error: function(response, ioArgs){
dojo.byId("toBeReplaced").innerHTML =
"An error occurred, with response: " + response;
return response;
}
});
alert(self.data.donneedujson);
} |
Partager