Ajax.ActionLink从Javascript触发? [英] Ajax.ActionLink triggering from Javascript?

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

问题描述

我成功地使用@ Ajax.ActionLink刷新我的网页上的部分数据,但我想从JavaScript这样做。我怎么能模拟点击的效果,ActionLink的在JS?

谢谢!

  @ Ajax.ActionLink(ClickMe,列表,组织,新AjaxOptions随着{.UpdateTargetId =dashboardDetails})
 

解决方案

您需要看使用 $获得()。$后() jQuery的功能。所以基本上,你可以执行呼叫到一个控制器的动作,在Javascript中,使用这两种功能(取决于你获得或发布的数据)。

这是实施例可以发现<一href="http://weblogs.asp.net/srkirkland/archive/2009/09/08/using-jquery-ajax-methods-in-asp-net-mvc-get-and-getjson-vs-post.aspx"相对=nofollow>这里。

I am successfully using @Ajax.ActionLink to refresh data on a portion of my page, but I would like to do the same from Javascript. How can I simulate the effects of clicking that ActionLink in js?

Thanks!

@Ajax.ActionLink("ClickMe", "List", "Organizations", New AjaxOptions With {.UpdateTargetId = "dashboardDetails"})

解决方案

You need to look at using the $.get() and .$post() jQuery functions. So basically, you can perform a call to a controller action, from Javascript, using either of these functions (depending on whether your getting or posting data).

An example can be found here.

这篇关于Ajax.ActionLink从Javascript触发?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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