0 out of 4 rated this helpful - Rate this topic

AjaxOptions.OnSuccess Property

Gets or sets the JavaScript function to call after the page is successfully updated.

Namespace:  System.Web.Mvc.Ajax
Assembly:  System.Web.Mvc (in System.Web.Mvc.dll)
public string OnSuccess { get; set; }

Property Value

Type: System.String
The JavaScript function to call after the page is successfully updated.

This function is called if the response status is in the 200 range.

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
onSuccess function signature
the following is copied from the 3.5 version community content, posted by Neil Moss

OnSuccess function signature

The method signature is:

function myOnSuccessEventHandler(ajaxContext)
{
...
}

ajaxContext provides:

get_data() method to get the response from the server.
_response property to get further details of the response.

plus others.

_response appears to be an instance of Sys.Net.XMLHttpExecutor - see http://msdn.microsoft.com/en-us/library/bb397459.aspx

e.g.

ajaxContext._response.get_statusCode() to get the http status code value of the response.

ajaxContext._response.getResponseHeader(headerName) to get the value of an http response header, e.g. "Content-Type"