This method is the raw method that initiates method callback to a AjaxMethodCallback control or a wwCallbackHandler derived Http handler on the server routing to methods marked with [CallbackMethod] attributes on the target object.
// *** Create the callback class and pass the ID of the Callback control
var Manual = new AjaxMethodCallback();
Manual.serverUrl = "SimpleMethodcallbacks.aspx"; // optional - default to current page
// *** Optionally specify a server control to route the callback to
// Manual.targetControlId = "MyServerControl"
// *** You can specify how data is posted back. Get, Post, PostNoViewState and parameters only (default)
Manual.postbackMode = "PostMethodParametersOnly";
// *** Call method: Method name, Array of parameters, Callback and Error handlers
Manual.callMethod("HelloWorld", [$("#txtName").val()],
function(result) {
alert(result);
},
function(error) {
alert("Error: " + error.message);
});
Parameters are passed in an array and should be passed as JavaScript values/objects which are turned into JSON arguments.
wwCallbackMethod.callMethod(Method,[Parameters],CallbackHandler,ErrorHandler)
Parameters
Method
The method on the server to call. The server method must be marked with [CallbackMethod] attribute on the server.
[Parameters]
Any number of parameters stored in an array.
Example: [121,122,"Rick",{Name:"Rick",Company:"west wind"}]
Values should be passed as straight JavaScript values/objects and they are JSON encoded by the client library.
Handler
The client side javascript handler that is called when the remote call completes. The function receives the result value of the method call. The result is a javascript typed that matches the server result type.
Error
The client side javascript handler that is called when an error occurs.
See also:
Class AjaxMethodCallback© West Wind Technologies, 1996-2024 • Updated: 10/03/08
Comment or report problem with topic