Este artículo proviene de un motor de traducción automática. Mueva el puntero sobre las frases del artículo para ver el texto original. |
Traducción
Original
|
Controller.JavaScript (Método)
Crea un objeto JavaScriptResult.
Espacio de nombres: System.Web.Mvc
Ensamblado: System.Web.Mvc (en System.Web.Mvc.dll)
Parámetros
- script
- Tipo: System.String
Código JavaScript que se va a ejecutar en el cliente.
Valor devuelto
Tipo: System.Web.Mvc.JavaScriptResultObjeto JavaScriptResult que escribe el script para la respuesta.
The following example shows how to send jQuery code from the server to the client. The script runs immediately when the client receives it. When the "Test JavaScript" link is selected, the jQuery client script is sent to the browser and the browser displays "JavaScript Passed".
<i><b>JavaScript Passed</b></i> will appear on the next line when you click the <b>Test JavaScript</b> link.<br /> <div id="divResultText"></div> <%= Ajax.ActionLink("Test JavaScript", "TestJavaScript", new AjaxOptions{UpdateTargetId = "divResultText"}) %>
public ActionResult TestJavaScript() { string s = "$('#divResultText').html('JavaScript Passed');"; return JavaScript(s); }
Contenido de la comunidad
Agregar