jQuery 1.4 breaks ASP.NET MVC parameter posting.

jQuery 1.4 breaks ASP.NET MVC parameter posting.

Background: Using ASP.NET MVC if you post to an action using the same variable names as those on the method signature it automatically parses them for you.


However with jQuery 1.4 if you post an ARRAY it changed how the post variable name is formed, adding [] to the end. This is an impasse since I obviously cannot append [] to my variable name in the controller.


At the moment this is a huge problem if we intend to upgrade to v1.4... ever.


jQuery 1.3.2 post data:
{myarrayvar=something&myarrayvar=somethingelse&anothervar=true}


jQuery 1.4 post data:
{myarrayvar%5b%5d=something&myarrayvar%5b%5d=somethingelse&anothervar=true}


Note the %5b%5d => []


Here's an example:
$.ajax({
        type: "POST",
        url: "/Home/Index",
        data: { myarrayvar: ["something", "somethingelse"], anothervar: true},
...etc





public ActionResult Index(string[] myarrayvar, bool anothervar) {


    jQuery 1.3.2:
        myarrayvar.Length == 2


    jQuery 1.4:
        myarrayvar == null !


    Which makes sense since the variable name is no longer "myarrayvar", it is now "myarrayvar[]".

}