jQuery Ajax POSTing array to ASP.NET MVC Controller

后端 未结 2 1180
礼貌的吻别
礼貌的吻别 2020-11-29 01:05

I\'m missing something here. I\'ve got this jQuery JavaScript:

$.ajax({
    type: \"POST\",
    url: \"/update-note-order\",
    dataType: \"json\",
    data         


        
2条回答
  •  难免孤独
    2020-11-29 01:53

    Just set the traditional parameter to true:

    $.ajax({
        type: "POST",
        url: "/update-note-order",
        dataType: "json",
        traditional: true,
        data: {
            orderedIds: orderedIds,
            unixTimeMs: new Date().getTime()
        }
    });
    

    Since jquery 1.4 this parameter exists because the mechanism to serialize objects into query parameters has changed.

提交回复
热议问题