User:Locke/common.js: Difference between revisions
Jump to navigation
Jump to search
Want an adless experience? Log in or Create an account.
mNo edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
function DataLoader( basepage ) { | function DataLoader( basepage ) { | ||
this.loadData = function( subpage ) { | this.loadData = function( subpage ) { | ||
api.ajax( { | mw.loader.using( 'mediawiki.api', function () { | ||
(new mw.Api()).ajax( { | |||
action: 'parse', | |||
format: 'xml', | |||
prop: 'text', | |||
page: basepage + '/' + subpage | |||
} ).done ( function ( data ) { | |||
console.log( data ); | |||
} ); | |||
} ); | } ); | ||
}; | }; |
Revision as of 14:55, November 4, 2014
function DataLoader( basepage ) { this.loadData = function( subpage ) { mw.loader.using( 'mediawiki.api', function () { (new mw.Api()).ajax( { action: 'parse', format: 'xml', prop: 'text', page: basepage + '/' + subpage } ).done ( function ( data ) { console.log( data ); } ); } ); }; } var loader = new DataLoader( 'User:Locke' ); loader.loadData( 'Sandbox' );