I am working on an MVC 3 project and I have an ajax request ($.ajax) that passes a javascript Array to a controller and returns an HTML result (a partial view with a select element and options).
When the array is 46 items or larger, the call to the controller is not made (I have a break point on the controller and it is not triggered).
I then changed the ajax to request to a $.ajax of type 'POST' and the request runs fine, with all data from he array present.
I have Googled around trying to understand why this may be so but have come up empty, besides this question from stack overflow, which does not help me much, as it speaks generally between the difference between get and post requests - no observable changes on the server (which is what i want) vs changes on server side. I am simply loading data for the user to select from.
Perhaps it is my understanding of ajax get and post requests that is a little fuzzy, but if anyone has ever encountered this kind of issue and understands why, I would very much appreciate the feedback. :)
Below is a sample of the code I am trying to execute:
$(function () {
$('#SelectedCategory').change(function () {
//create array of selected attributes to limit returned results set
var currentAttribs = new Array();
$('#cboSelectedAttributes option').each(function () {
currentAttribs.push(this.text);
});
//retrieve available attributes from server excluding current selections
$.ajax({
url: folder + '/Index_GetAttributes',
type: "POST",
data: { strCategory: $(this).find(':selected').val(), lstCurrentAttributes: currentAttribs },
traditional: true,
success: function (result) {
$('#divAvailAAttribs').html(result);
}
});
});
});
Thanks!