User:Suppa chuppa/callapi.js

function callAPI(data, method, callback) { data['format'] = 'json'; $.ajax({		data: data,		dataType: 'json',		url: wgScriptPath + '/api.php',		type: method,		success: function(response) {			if (response.error) {				showError('API error: ' + response.error.info);			} else {				callback(response);			}		},		error: function(xhr, error) { showError('AJAX error: ' + error); },		timeout: 10000 // msec	}); }