if( typeof options.url == 'undefined' || options.url === false){
if(!wgServer || ! wgScriptPath){
return js_error('Error: no api url for api request');;
- }
- if (wgServer && wgScript)
- options.url = wgServer + wgScript;
+ }
//update to api.php (if index.php was in the wgScript path):
- options.url = options.url.replace(/index.php/, 'api.php');
+ options.url = mwGetLocalApiUrl();
}
if( typeof options.data == 'undefined' )
options.data = {};
loadExternalJs( req_url );
}
}
+function mwGetLocalApiUrl(url){
+ if (wgServer && wgScript){
+ url = wgServer + wgScript;
+ return url.replace(/index.php/, 'api.php');
+ }
+ return false;
+}
//grab wiki form error for wiki html page proccessing (should be depricated)
function grabWikiFormError ( result_page ){
var res = {};