In the Code Snippet below (as a standalone example) i tried to get a simple answer from a perl(cgi) script which works in the sense that the response_object has the data i want/expect
As i understood it from several sources the callback function would fire after a successful response.
When i check the value of "answer" before returning it or the value of "loginStatus" after functest has run its course i recieve "false" in both cases even tough the value recieved and processed in the callback is correct and should set "answer" to true.
Am i missing something here with the callback/RPC ?? or is the Problem somewhere else ??
....
.....
As i understood it from several sources the callback function would fire after a successful response.
When i check the value of "answer" before returning it or the value of "loginStatus" after functest has run its course i recieve "false" in both cases even tough the value recieved and processed in the callback is correct and should set "answer" to true.
Am i missing something here with the callback/RPC ?? or is the Problem somewhere else ??
....
Code:
<SCRIPT>var isomorphicDir="../../isomorphic/";</SCRIPT>
<SCRIPT SRC=../../isomorphic/system/modules/ISC_Core.js></SCRIPT>
<SCRIPT SRC=../../isomorphic/system/modules/ISC_Foundation.js></SCRIPT>
<SCRIPT SRC=../../isomorphic/system/modules/ISC_Containers.js></SCRIPT>
<SCRIPT SRC=../../isomorphic/system/modules/ISC_Grids.js></SCRIPT>
<SCRIPT SRC=../../isomorphic/system/modules/ISC_Forms.js></SCRIPT>
<SCRIPT SRC=../../isomorphic/system/modules/ISC_DataBinding.js></SCRIPT>
<SCRIPT SRC=../../isomorphic/skins/SmartClient/load_skin.js></SCRIPT>
<SCRIPT SRC=../../isomorphic/locales/frameworkMessages_de.properties></SCRIPT>
Code:
<SCRIPT>
isc.Button.create(
{
left:20,
title: "Login",
click : function () {
isc.showLoginDialog(function (credentials, dialogCallback) {
var loginStatus = functest(credentials.username,credentials.password);
console.log("LOG "+ loginStatus);
dialogCallback(loginStatus);
},
{
dismissable: true
});
},
top:45
});
function functest (user,pass) {
var answer = false;
isc.RPCManager.sendRequest({
actionURL: "scripts/logcheck.pl",
containsCredentials:true,
httpMethod: "POST",
useSimpleHttp: true,
showPrompt:false,
serverOutputAsString: true,
params: { j_username: user,
j_password: pass},
callback: function (RpcResponse_o) {
if (RpcResponse_o.data == "1") {
answer = true;
console.log("change_aw"+ answer);
}
}
});
console.log("return_aw"+ answer);
return answer;
}
</SCRIPT>
Comment