I have almost no experience or training in Ajax. I was recently tasked with maintaining a C# MVC program that makes use of an Ajax call as the final step in the download process of a zip file. It seems to be crashing when the incoming zip file has too many files. As far as I can tell this is a conventional Ajax routine. It has a 'Success:' section and an 'Error:' section.
If the conditions are such that the system is working (just a few files), I can put window.alert popups in the Success: section and observe the processing(inside the for loop, for example). It the number/size of files is excessive (546 for example, in a 646 meg zip file) the system goes directly to the 'Error:' section without ever displaying my popups.
The errorThrown value is 'Internal Server Error'. Beyond that I haven't found anything else so far.
Any suggestions for further troubleshooting?
The Ajax is as follows:
$.ajax({
url: url,
type: 'POST',
contentType: 'application/json',
data: JSON.stringify({ ids: ids, themeId: themeId }),
success: function (result) {
var form = $('<form method="POST" action="' + url + '">');
for (var i = 0, count = ids.length; i < count; i++) {
form.append($('<input type="hidden" name="ids[' + i + ']" value="' + ids[i] + '">'));
}
form.append($('<input type="hidden" name="themeId" value="' + themeId + '">'));
$('body').append(form);
form.submit();
$('.loader-wrap').hide();
$('.btn-pickup-download, .btn-pickup-download-all').removeClass('disabled');
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
$('.loader-wrap').hide();
$('.btn-pickup-download, .btn-pickup-download-all').removeClass('disabled');
alert('The requested report(s) is unavailable. If you have any questions, please contact your Account Manager.');
}
});