Widget:UserExamQuery: Difference between revisions
Jump to navigation
Jump to search
Matt Pijoan (talk | contribs) Created page with "<includeonly> </includeonly>" |
Matt Pijoan (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
<includeonly> | <includeonly> | ||
<script type="text/javascript"> | |||
function ensureLoggedIn() { | |||
mw.loader.load('mediaWiki.user'); | |||
if ($.isEmptyObject(wgUserName)) { | |||
alert("Please Log In To Continue."); | |||
window.location.replace("http://wikidoc.org/index.php?title=Special:UserLogin&returnto=UserExamQuery"); | |||
} else { | |||
runQuery(); | |||
} | |||
} | |||
function runQuery(){ | |||
var api = new mw.Api(); | |||
api.get({ | |||
action : 'ask', | |||
username : username, | |||
format : 'json' | |||
}) | |||
.always(function (data) { | |||
console.log(data); | |||
}); | |||
} | |||
</script> | |||
</includeonly> | </includeonly> |