var reqData = {
'action': 'watch',
+ 'format': 'json',
'title': $link.data( 'target' )
};
if ( $link.data( 'action' ) == 'unwatch' ) {
reqData['unwatch'] = '';
}
- mw.api(reqData,
+ $.getJSON( mw.config.get( 'wgScriptPath' )
+ + '/api' + mw.config.get( 'wgScriptExtension' ),
+ reqData,
function( data, textStatus, xhr ) {
wgAjaxWatch.processResult( data, $link );
}
return mediaWiki.message.apply( mediaWiki.message, arguments ).toString();
};
- /**
- * Performs an API call
- *
- * @param data object Call parameters
- * @param callback function Function to be called on success, see jQuery.getJSON() for details
- */
- this.api = function( data, callback ) {
- var url = this.config.get( 'wgScriptPath' ) + '/api' + this.config.get( 'wgScriptExtension' );
- data.format = 'json';
- return jQuery.getJSON( url, data, callback );
- }
/**
* Client-side module loader which integrates with the MediaWiki ResourceLoader
*/