简体   繁体   中英

javascript or ajax actionlink

I am working with mvc4 and new to working with it. I have a question around the 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.

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? What are the pros and cons of either approach?

Both are same.

  1. Ajax ActionLink : less to write, works with conjuction Jquery un-obtrusive. Not much control on the markup.
  2. HtML Link + Jquery Ajax call : will you give full control on the click event, you can add extra options to it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM