Calling Code-behind from Javascript

前端 未结 3 1513
借酒劲吻你
借酒劲吻你 2020-12-18 11:11

On the click of a button, I call a JavaScript function. After getting the value, I need to perform some stuff from the value obtained in the code-behind. How should I call c

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-18 11:23

    You can put the server side code into a web service, make a service reference in an asp:ScriptManager on your aspx page and then you can call/execute the web service from javascript by calling:

    WebServiceClassName.MethodName(javascriptvariable, doSomethingOnSuccess)
    

    Here is a link on doing that:

    http://msdn.microsoft.com/en-us/magazine/cc163499.aspx

提交回复
热议问题