Controller.JavaScript Method (String)

 

Creates a JavaScriptResult object.

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

Syntax

protected internal virtual JavaScriptResult JavaScript(
    string script
)
public protected:
virtual JavaScriptResult^ JavaScript(
    String^ script
)
abstract JavaScript : 
        script:string -> JavaScriptResult
override JavaScript : 
        script:string -> JavaScriptResult
Protected Friend Overridable Function JavaScript (
    script As String
) As JavaScriptResult

Parameters

  • 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.

Remarks

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.

See Also

Controller Class
System.Web.Mvc Namespace

Return to top