Search code examples
asp.net-mvc-ajax

CAn i Call a MVC POST controller method in jquery


For some time I am worknig in MVC, I learnt from this post, http://evolpin.wordpress.com/2011/04/12/asp-net-mvc-partialview-with-ajax/#comment-435

that to load a usercontrol using AJAX, ww can use jquery, but Jquery is only taking GET Controller method name, Can I call a POST controller method name using JQUERY?


Solution

  • Yes, jQuery has a .post() function for submitting POST requests to a server resource. Note that it's just a wrapper for the .ajax() function:

    This is a shorthand Ajax function, which is equivalent to:
    
    $.ajax({
      type: 'POST',
      url: url,
      data: data,
      success: success,
      dataType: dataType
    });