Controller.JavaScript Method (String)


Creates a JavaScriptResult object.

Namespace:   System.Web.Mvc
Assembly:  System.Web.Mvc (in System.Web.Mvc.dll)

protected internal virtual JavaScriptResult JavaScript(
	string script


Type: System.String

The JavaScript code to run on the client

Return Value

Type: System.Web.Mvc.JavaScriptResult

The JavaScriptResult object that writes the script to the response.

This method is used to send JavaScript code that is created on the server to the client. The JavaScript is automatically run on the client. The result object that is prepared by this method is written to the response by the ASP.NET MVC framework when the object is executed.

Return to top