MediaWiki:Common.js/User:Gryllida/GalleryThings

alert('hi');

function refreshList(){

 alert('3');
 $('<input/>',{name:"Foo"}).appendTo('#gt-list');

$.ajax( {

   'url': 'https://commons.wikimedia.org/w/api.php',
   'data': {
       'action': 'query',
       'meta': 'userinfo',
       'format': 'json',
       'origin': 'https://www.mediawiki.org'
   },
   'xhrFields': {
       'withCredentials': true
   },
   'success': function( data ) {
       alert( 'Foreign user ' + data.query.userinfo.name +
           ' (ID ' + data.query.userinfo.id + ')' );
   },
   'dataType': 'json'

} );

 $('<input/>',{name:"Bar"}).appendTo('#gt-list');
 $('#gt-list > input').each(function(){
   alert(this.name);
 });

}

$(document).ready( function() {

 alert('2');
 $('#gt-refresh').click(refreshList);

});