在MVC Page_Load事件中调用一个函数 [英] Invoking a function on Page_load event in MVC
问题描述
我开发MVC应用程序。
我想打电话给在页面的页面加载事件JavaScript函数。
另外我想一些字符串参数传递给这个函数,我想显示为证实消息的内容。在确认的确定一下,我想显示警报。
我怎样才能做到这一点?
I am developing an MVC application. I want to call a javascript function on page load event of a page. Also I want to pass some string parameters to this function which i want to show as confirm message content. On confirm's OK click, i want to show an alert. How can i do this?
谢谢,
卡皮尔
Thanks, Kapil
推荐答案
如果你正在考虑传统的ASP.NET服务器端的Page_Load事件然后忘掉它。而使用像jQuery和有一个js函数执行客户端。你可以要直接给JS的PARAMS通过。
If you're thinking about traditional ASP.NET server side Page_Load events then forget about it. Rather use something like jQuery and have a js function execute client side. You can pass in the params you want directly to the js.
这篇关于在MVC Page_Load事件中调用一个函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!