Ajax.ActionLink从Javascript触发?Ajax、ActionLink、Javascript

由网友(不和群的小仙女)分享简介:我成功地使用@ Ajax.ActionLink刷新我的网页上的部分数据,但我想从JavaScript这样做。我怎么能模拟点击的效果,ActionLink的在JS?谢谢!@ Ajax.ActionLink(ClickMe,列表,组织,新AjaxOptions随着{.UpdateTargetId =dashboardDet...

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

谢谢!

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

解决方案

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

高薪的web前端工程师必会的19 个 JavaScript 简写技巧

这是实施例可以发现这里。

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.

阅读全文

相关推荐

最新文章