var remoteScript = './s/lib/remote.php'; /* // async - TODO do zastosowania callBack ????? function get_information(links, callback) { $.ajax({ type: "POST", url: "get_yt.php", data: {url: links} }).done(function( rHTML ) { callback(rHTML); }); } */ function callRemote(scriptName, className, functionName, functionArguments, async, remoteScript2) { //alert(functionName + " " +functionArguments.length + " " +functionArguments[0]); var methodPath = scriptName.replace("/", ".").replace("class.php", "") + className+'.'+functionName; var myRemoteScript = remoteScript+'?method='+methodPath; var params = new Array(); for(var ia = 0; ia < functionArguments.length; ia++) { params.push(functionArguments[ia]); } var tmpResult = null; $.ajax({ url: myRemoteScript, data: { params: JSON.stringify(params) }, async: false, cache: false, type: "POST", success: function(result) { // alert("DEBUG:" + result); tmpResult = result; } }); if(tmpResult.indexOf("ERROR") == 0 || tmpResult.indexOf("INFO") == 0 || tmpResult.indexOf("STOP") == 0) { alert("Blad !!! " + tmpResult); } else { tmpResult = JSON.parse(tmpResult); } return tmpResult; }