发送Html.ActionLink来发布动作 [英] Sending Html.ActionLink to post action

查看:67
本文介绍了发送Html.ActionLink来发布动作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用 Html.ActionLink 向mvc控制器上的 HttpPost 操作发送请求?

Is it possible using Html.ActionLink send request to HttpPost action on mvc controller?

推荐答案

您不能使用ActionLink,因为这只会呈现锚标记.您可以使用JQuery AJAX帖子,请参见 http://docs.jquery.com/Ajax/jQuery.post 或仅在带有或不带有JQuery的情况下调用表单的Submit方法(这将是非AJAX),也许在任何您喜欢的控件的onclick事件中."

"You can't use an ActionLink because that just renders an anchor tag. You can use a JQuery AJAX post, see http://docs.jquery.com/Ajax/jQuery.post or just call the form's submit method with or without JQuery (which would be non-AJAX), perhaps in the onclick event of whatever control takes your fancy."

请参阅: https://stackoverflow.com/a/2049191/4337413

这篇关于发送Html.ActionLink来发布动作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆