I found few good links ( href="https://stackoverflow.com/questions/6847697/how-to-return-value-from-an-asynchronous-callback-function">How
to return value from an asynchronous callback function? and href="https://stackoverflow.com/questions/23339907/returning-a-value-from-callback-function-in-node-js">Returning
a value from callback function in Node.js etc) of SO but they are not not able
to provide solution to my problem.
My Problem: able
to get result of asynchronous call, but how I can use this result for returning of my
function?
onsubmit = "return
checkForm(function(callBackResponse) { alert(callBackResponse)
});"
Here getting
value of callBackResponse either as true or false, and want to use this value as :
onsubmit = "return
responseFromCallBack;"
EDITED
: Here is my async stuff
function checkForm(callback)
{return firstCallBack(function secondCallBack(response) {
if (some
conditions) {
response = false;
callback(response);
}
else {
response =
true;
callback(response);
}
}
);
}
No comments:
Post a Comment