AJAX Post of JavaScript String Array to JsonResult as List<string> Always Returns Null? AJAX Post of JavaScript String Array to JsonResult as List<string> Always Returns Null? ajax ajax

AJAX Post of JavaScript String Array to JsonResult as List<string> Always Returns Null?


I faced the same problem after updating to jquery 1.4.2. You can find the solution here (in the Ajax section).

Adding traditional : true in the ajax options should work.

$.ajax({    type: "POST",    traditional: true,    url: "/Test/JSONTestAction",    async: false,    data: parms,    dataType: "json",    success: function(data) {        // success    }});


This change was to make native behavior better for PHP/Rails users, you can read about the params changes more here.

You can enable it per-request like this:

$.ajax({  //Stuff... traditional:true });

Or globally like this (only need to run once before firing any requests):

jQuery.ajaxSettings.traditional = true;