passing array from javascript to controller MVC 4

前端 未结 4 1362
抹茶落季
抹茶落季 2021-01-22 23:19

I am using razor and I\'m having a hard time passing an array to a controller. the array contains objects that I made and I am trying to do this:

$.ajax({
     t         


        
4条回答
  •  终归单人心
    2021-01-22 23:50

    Usage of the traditional: true parameter for an ajax call:

    To help radbyx, using the "traditional: true" property of an ajax call, like the following, will tell ajax to use the traditional form of serialization. More details: http://api.jquery.com/jQuery.param/ or What is "traditional style of param serialization' in JQuery.

    $.ajax({
         type: "POST",
         url: "HomePage/HandleOperations",
         data: {operations: operationCollection},
         traditional: true,
         success: function (data) { alert("SUCCESS"); }
    });
    

提交回复
热议问题