문제

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.
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top