User:JJPMastwo/common.js

var params = { action: 'logout', format: 'json' },	api = new mw.Api;

api.postWithToken( 'csrf', params ).done( function ( data ) {	console.log( data ); } );