Hi, I joined this group today in the hope that I will get help with one API issue I am having now. I am trying to get the number of user edits through an AJAX call. I have tested this script in English Wikipedia and Malayalam Wikipedia and it works there in all browsers. But this script is not working in *Wikipedia Commons*.
Pasting my script below. Any help with this is appreciated. /***********************************************************************************************************/ *function* liveEditCounter(username) { *var* xhr; *try* { xhr = *new* XMLHttpRequest(); } *catch*(e) { xhr = *new* ActiveXObject("Microsoft.XMLHTTP"); } xhr.onreadystatechange = *function*() { *if*(xhr.readyState == 4) { *if*(xhr.status == 200 || xhr.status == 0) { *var* jsonOutput = *eval*('(' + xhr.responseText + ')'); document.getElementById("firstHeading").innerHTML = document.getElementById( "firstHeading").innerHTML + " (Edits: " + jsonOutput.query.users[0]. editcount + ")"; } } }; xhr.open('GET', " http://commons.wikipedia.org/w/api.php?action=query&list=users&ususers="+ username+"&usprop=editcount&format=json", *true*); xhr.send(*null*); } /***********************************************************************************************************/ The issue here is that xhr.responseText is returning me a blank value. Thanks for the help in advance. - Sreejith K.
_______________________________________________ Mediawiki-api mailing list Mediawiki-api@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-api