Pass array to ajax request in $.ajax()

后端 未结 2 1675
梦毁少年i
梦毁少年i 2021-01-22 14:48

I have tried like this but could not get array list. It returns \'null\'

 var data=[];
 data[0] = \'1\';
 data[1] = \'2\';
    $.ajax({                    
              


        
2条回答
  •  盖世英雄少女心
    2021-01-22 15:44

    Its the way you are expecting to recive the data in the action method, try

    public JsonResult AddFrequencyWeekly(IEnumeable data)
    {
    
    }
    

提交回复
热议问题