0

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?

Andrew Barber
  • 39,603
  • 20
  • 94
  • 123
amateur
  • 43,371
  • 65
  • 192
  • 320

1 Answers1

0

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.
Ravi Gadag
  • 15,735
  • 5
  • 57
  • 83
  • Following clicking on ajax actionlink, can a json object be returned back to a javascript function, if its successful? I want to take the json and use knockout to bind it to a table. – amateur Feb 13 '13 at 01:07
  • @amateur http://stackoverflow.com/questions/4020705/ajax-beginform-calls-action-returns-json-how-do-i-access-json-object-in-my-on – Ravi Gadag Feb 13 '13 at 01:09