2
Contributors
1
Reply
19
Views
3 Years
Discussion Span
Last Post by harsh9
0

Yes it is possible but don't use Ajax.ActionLink.
Keep it simple - use jQuery - then you have total control:

$(function() {
   $('#somelink').click(function(e) {
      e.preventDefault();
    get('/controller/action1', function(data) {
             $('#up').html(data);
          });

          $.get('/controller/action2', function(data) {
             $('#down').html(data);
          });


   });
});

You should use Url.Action or Url.RouteUrl to generate the URL for the AJAX call, so if your routes change then your JS need not, e.g:

.get('@Url.Action('Controller', 'Action1')', function(data)

or

.get('@Url.RouteUrl('SomeNamedRoute')', function(data)

If your putting this script in an external file then you'll need to use a technique to set the url in the main view, then read from the external variable.

Such techniques include a JavaScript variable, hidden field, passing URL to function as parameter, etc.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.