Sys.Net.WebRequestManager add_completedRequest Method

Registers a handler for the completed request event of the WebRequestManager.

Sys.Net.WebRequestManager.add_completedRequest(handler);

Parameters

Parameter

Description

Handler

The function registered to handle the completed request event.

Remarks

This completed request event is raised after the request has completed, and is used for processing return data. Use the add_completedRequest method to set the JavaScript function that the WebRequestManager object must use after the Web request is completed. The WebRequestManager object issues this event before any WebRequest instance completed events occur. When the network executor finishes the network call (which can result in successful completion, an abort, or a time-out), the handler you added runs first. After your event handler returns, the original event handler on the WebRequest instance runs.

This event lets you inspect or log the data sent back by the executor.

Your event handler must have the following signature:

function OnWebRequestComplete(sender, eventArgs) {}

The sender parameter is set to the WebRequestExecutor instance that raised the completed event.

The eventArgs argument is set by the executor that raised the completed event. For Microsoft executors, this argument is always EventArgs.Empty. However, custom executors can set this to some other value.

Example

The following example shows how to add an event to be issued after the Web request is executed. It also shows how to set the related event handler. This code is part of a complete example found in the WebRequestManager class overview.

// Set the handler to process the Web request.
Sys.Net.WebRequestManager.add_completedRequest(On_WebRequestCompleted);

See Also

Reference

Sys.Net.WebRequestManager Class

Sys.Net.WebRequestExecutor Class

Sys.Net.XMLHttpExecutor Class