0

I'm using window.location.href = "some ajax call"; for exporting, but when there is large number of data (for eg.5000),I'm getting the result as "Request-URI Too Large "pathname" does not allow request data with GET requests, or the amount of data provided in the request exceeds the capacity limit."

Can someone please provide me the solution for this problem?

  • 1
    First of all `window.location.href` is used to redirect the browser; how is this related to "some ajax call"? Second, the error means that you are trying to do GET with the data in the query string. Query string has a limit. You should use POST instead. And finally - what does your question have to do with AngularJS? – New Dev Feb 09 '15 at 04:14

1 Answers1

0

Because url has its limitation, url length can not be exceeds 2,000 characters.

You should use POST request instead of GET and send data inside body.

CODE

    $http({
        type: 'POST',
        url: exportUrl, //this should not contain data
        data: "data=" + escape(JSON.stringify(exprotData)),
        success: function (data) {
            //success code
        },
        error: function (error) {
            //error code
        }
    });

Hope this could help you. Thanks.

Community
  • 1
  • 1
Pankaj Parkar
  • 134,766
  • 23
  • 234
  • 299