My previos post explained the way to expose a web service to client script in Ajax. This post will introduce the "How to" call the web service's method from the client script.
Our web service is:
1 | namespace MySamples.BL |
Calling a Web service method from script is asynchronous. Succeeded callback function must provided to get a return value or to determine when the request has returned. This function is invoked when the request has finished successfully with return value (as a parameter) from the Web method call. Failed callback function can also provided to handle errors.
Based on the previous post, this is what you should do in the client script.
The script is:
1 | // This function calls the Web service method // This function calls the Web service method |
Thats all!
No comments:
Post a Comment