I study the technology of client-server applications and sites. And got to ASP.NET and JavaScript. So. There is an ASP.NET project. There is CS_file.cs:

[WebMethod(EnableSession = true)] public string[] GetPersonalInfo(int iParam_1, int iParam_2) { //Some code return Rez; } 

There is an ASPXfile.aspx

  <script type="text/javascript"> <!-- //... function OnGetParam() { int iPar1, iPar2; //Some code CS_file.GetPersonalInfo(iPar1, iPar2, OnGetInfo); } //... function OnGetInfo(result) { //do something } //... //--> </script> 

Here everything seems to be clear. Client-side JavaScript calls a method on the server without page overload. (Correct if I misunderstand) Attention question. How does OnGetInfo accept and understand that this is the result of the method on the server? What is this "magic" and where to read about it? A similar example here: tynts

    1 answer 1

    This is called a callback function or "callback function", and the entire JavaScript event model is considered and built upon them. In short, the browser generates a request and executes it, as soon as it receives a response from the server, it looks at what function it needs to call (link to it in the third parameter GetPersonalInfo) and calls it already with passing parameters to it.

    You can read about JavaScript technology called Ajax, which is used.

    • By the way, at the bottom of the similar example, the links are given and ASP.NET Ajax is mentioned. - Alex Krass
    • Thanks for the clarification and tip - FankyD