I have implemented AJAX for calling server side function using client side function call i.e Calling server side function using javascript tag by using PageMethod in javascript.
I have few question regarding the same implementation.
function OnBlurCall()
{
chk(ControlId, SpanMsgId, FunctionName)// where all these parameters are obtained from programmer.
}
function chk(ControlId,SpanMsgId, FunctionName)
{
PageMethods.FunctionName(ControlId.value,onSuccess,onFail,SpanMsgId); // I want to replace actual value of FunctionName i.e Something given below
PageMethods.CheckUserNameAvailability(ControlId.value,onSuccess,onFail,SpanMsgId);
}
function onSuccess(result,MsgId,methodname)
{
MsgId.innerHTML=result;
}
function onFail(error,MsgId,methodname)
{
MsgId.innerHTML=error;
}
Ques 1. How many parameters can i add to this function. Is it there some limit that i can send only 3 parameters. Please give some details how it is working.
Ques 2. I want to make above code reusabe in javascript such that I add all the 3 functions in master page. But the problem is that i can add two functions into javascript at this time. But for adding 3rd function i have to send function name also as a parameter.
PageMethods.FunctionName(ControlId.value,onSuccess,onFail,SpanMsgId);
This FunctionName will be the name of server side function that a developer want to call. Can i do this. ?