0

I'm trying to call a controller method by Ajax like this:

$.get("@Url.Action("MethodName", "ControllerName")",
     {
        groupID: Id,
        namePt: pt,
        nameEn: en,
        nameFr: fr,
        nameAr: ar,
        selectedProducts: listProd
      },
      function success(data) {
        //do something
      }).fail(function() {
        //do something
      });

I fill the listProd with values (products IDs) from a drop down list.

The problem is when the listProd contains more than 81 items... the controller method is not called and no error is displayed.

When the listProd contains 81 items or less, all works fine.

Is there a size limit to a list in ajax call?

Victor
  • 109
  • 1
  • 6
  • Answer via Google: [Maximum length of an HTTP GET request](http://stackoverflow.com/questions/2659952/maximum-length-of-http-get-request) – Brett Jul 30 '14 at 15:11
  • 1
    In other words, you should be using POST, not GET. – Brett Jul 30 '14 at 15:13
  • If you do require an http get (If you access a resource and you don't modify anything, the post verb can be misleading), you can modify the maximum size of Get requests in your web server's configuration. – Jazzwave06 Jul 30 '14 at 15:40

1 Answers1

0

The solution is to use $.post instead $.get

Victor
  • 109
  • 1
  • 6