In javascript, you can use "<%=%>" to call the background, and the syntax is "<%=method>". Javascript calls a server-side exe or a function in a dll, or even a Linux binary executable file, runs it on the server, and returns the result to js after running.
The operating environment of this tutorial: Windows 7 system, JavaScript version 1.8.5, Dell G3 computer.
javascript calls the background method
##Directly use <%=%>call
Front-end JS:<script type="text/javascript"> var methodStr = "<%=BehindMethod() %>"; alert(methodStr); </script>
public static string BehindMethod() { return "这是一个后台的方法"; }
BehindMethod()public
Access modification before the method Don’t forget the symbol;
ASPX page is loaded or posted back, and the call cannot be controlled manually.
The above is the detailed content of JavaScript calls background methods. For more information, please follow other related articles on the PHP Chinese website!