I was wondering if it is possible to keep calling a function in JavaScript
many times in codebehind (asp.net WebForm)
with different parameters and return values, for example I have this JavaScript
function that is called Add(x,y)
that returns the sum and I want to call it again with different parameters.
Note: The function name is just an example
Use Clientscript.RegisterClientScriptBlock for multiple call like
ClientScriptManager cs = Page.ClientScript;
StringBuilder csText = new StringBuilder();
csText.Append("<script type=\"text/javascript\"> ");
csText.Append("result1=Add(x,y);");
csText.Append("result2=Add(result1,b);");
csText.Append("</script>");
cs.RegisterClientScriptBlock(csType, csName, csText.ToString());
https://msdn.microsoft.com/en-us/library/btf44dc9(v=vs.110).aspx
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.