0

I have a drop down list which consist more than 500 items. The dropdown list is allowing user to multi select.

var searchOption = $('#searchOptionOption').val();
var formData = {
searchOption: searchOption
};

My ajax

 $.ajax({
            type: 'GET',
            url: 'search',
            data: formData,
            dataType: 'html',
            success: function(html){
                ....
            },
            error: function (data){
                console.log('Error:', data);
            }
        });

The problem i faced was when user is selecting more than 200 items then it will caused error 404 page not found during ajax call. But, sometime it can displays the result, but if exceeded an amount then it will definitely show error 404 page not found.

Is it possible caused by a large amount of data passing through ajax? Any solution to fix this issue?

Maistrenko Vitalii
  • 994
  • 1
  • 8
  • 16
Crazy
  • 847
  • 1
  • 18
  • 41

1 Answers1

2

Yes, looks like there is a limit for JSON.

Refer this post for the answer

Solution:

in Web.Config add the following value (For ASP.net)

<appSettings>
  <add key="aspnet:MaxJsonDeserializerMembers" value="150000" />
</appSettings>

For PHP, change GET to POST

Kasnady
  • 2,249
  • 3
  • 25
  • 34
  • 1
    Thanks, i changed GET method to POST method then it worked. I am using laravel not asp.net. Anyway, thanks again for your answer. – Crazy Oct 06 '17 at 02:37
  • I agree, I ever once got my file corrupted when I save my php file in code editor which in the "1/1000 chance exactly same time" the file is working on ajax request while web is opened in browser. Fortunately I have the backup. Several times I can't save my file too, but a second later I can save it. – Taufik Nur Rahmanda Oct 06 '17 at 02:41