Reputation: 9621
I am calling a specific WebMethod from client side like this:
function openSmallPopup(int) {
PageMethods.GetTenantInfo(int, OnGetMessageSuccess, OnGetMessageFailure);
return 'I need here to return the result';
}
function OnGetMessageSuccess(result, userContext, methodName) {
alert(result);
}
Well, the result is successfully displayed in OnGetMessageSuccess
. The single problem is that I really need to return that result in the initial openSmallPopup
method...Do you guys know any way to do this?
Upvotes: 0
Views: 514
Reputation: 687
Why you want to that?? If you really want to do that then have to call initial function from OnGetMessageSuccess with result parameter and modify signature of initial function.
function openSmallPopup(int,result) {
if(arguments.length === 1){
PageMethods.GetTenantInfo(int, OnGetMessageSuccess, OnGetMessageFailure);
}else if (arguments.length === 2){
//use result here
}
return 'I need here to return the result';
}
function OnGetMessageSuccess(result, userContext, methodName) {
alert(result);
openSmallPopup(0,result);
}
But in practice i would rather take out that code from openSmallPopup into seperate function and call it in callback.
Upvotes: 1