[英]javascript or ajax actionlink
I am working with mvc4 and new to working with it. 我正在使用mvc4,并且是初次使用它。 I have a question around the Ajax ActionLink. 我对Ajax ActionLink有疑问。
I have a long list of products, with each, there is an add to bag button. 我的产品清单很长,每种产品都有一个“添加到购物袋”按钮。 In the past I would use jquery to bind a click event to this button and then use javascript to make a server side request to a controller action. 过去,我将使用jquery将click事件绑定到此按钮,然后使用javascript向控制器操作发出服务器端请求。
I want all interaction to not cause a full page postback. 我希望所有互动都不会引起整页的回发。
I am wondering is it best to follow my approach with javascript or use the Ajax ActionLink? 我想知道最好是用JavaScript跟随我的方法还是使用Ajax ActionLink? What are the pros and cons of either approach? 两种方法的优缺点是什么?
Both are same. 两者都一样。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.