| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- // WebServiceMultipleCallers.js
- // This function calls a Web service method
- // passing simple type parameters and the user context.
- function AddWithContext(a, b, userContext)
- {
- Samples.AspNet.WebService.Add(a, b,
- SucceededCallbackWithContext, FailedCallback, userContext, null);
- }
- // This function calls the Web service method
- // passing the method name.
- function AddWithMethod(a, b)
- {
- Samples.AspNet.WebService.Add(a, b,
- SucceededCallbackWithContext, FailedCallback);
- }
- // This is the callback function called if the
- // Web service succeeded. It accepts the result
- // object, the user context, and the method name as
- // parameters.
- function SucceededCallbackWithContext(result, userContext, methodName)
- {
- // It holds feedback message.
- var output = "";
-
- // Page element to display the feedback message.
- var RsltElem =
- document.getElementById("Results");
-
- if (userContext)
- {
- output += "The user context is : " + userContext + "<br/>";
- RsltElem.innerHTML = output;
- return;
- }
-
- if (methodName)
- output += "The method name is : " + methodName + "<br/>";
-
- RsltElem.innerHTML = output;
-
- }
- // This is the callback function called if the
- // Web service failed. It accepts the error object
- // as a parameter.
- function FailedCallback(error)
- {
- // Display the error.
- var RsltElem =
- document.getElementById("Results");
- RsltElem.innerHTML =
- "Service Error: " + error.get_message();
- }
- if (typeof(Sys) !== "undefined") Sys.Application.notifyScriptLoaded();
|