Widget:WBRControlPanel: Difference between revisions
Jump to navigation
Jump to search
Matt Pijoan (talk | contribs) No edit summary |
Matt Pijoan (talk | contribs) No edit summary |
||
Line 9: | Line 9: | ||
}); | }); | ||
}); | }); | ||
function getQues(){ | |||
var api = new mw.Api(); | |||
var QueryString = '[[ExamType::'+exam+']] [[MainCategory::'+MainCat[Math.floor(Math.random()*MainCat.length)]+']] [[SubCategory::'+SubCat[Math.floor(Math.random()*SubCat.length)]+']]'; | |||
api.get( { | |||
action: 'ask', | |||
query: QueryString, | |||
format: 'json', | |||
async: false | |||
}, { | |||
ok: function (data) { | |||
$.each(data.query.results, function(index, value){ | |||
Questions.push(index); | |||
}); | |||
} | |||
}) | |||
.error( function ( error ) { | |||
$.each(error, function(key, value) { | |||
alert(key + ': ' + value); | |||
}); | |||
} ); | |||
} | |||
</script> | </script> | ||
</includeonly> | </includeonly> |