Domanda

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?

È stato utile?

Soluzione

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.
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top