Description:
View:
In
this example we explain that how to call the JavaScript function in MVC Action
Result method.or how to call JavaScript method from controller in MVC. or how to
call JavaScript function in MVC 4 controller.there are many question are raised
in our mind to call the JavaScript function from back-end in MVC or call
JavaScript function from controller’s ActionReasult method.
<script type=”javascript”>
@ViewBag.calljavascriptfunction
function Javascriptfunction()
{
alert(“function
is called from the controller”);
}
</script>
Controller:
public ActionResult
Index()
{
ViewBag.calljavascriptfunction = "Javascriptfunction();";
return
View();
}
0 comments:
Post a Comment