Kalyani Shevale

Kalyani Shevale

  • NA
  • 3.2k
  • 711.5k

How to get arraylist from formData in action mvc

Dec 4 2018 10:57 PM
I have Used formData for getting values from Views. I have used one ArrayList in this ArrayList multiple parameters are used this ArrayList append in FormData object.
  1. var resultQuiz = [];  
  2.                      var fileData = new FormData();  
  3.            $.each($('#imgInp')[0].files, function (i, file) {  
  4.                fileData.append('file-' + i, file);  
  5.            });  
  6.            $("input[name=chkbox]:checked").each(function (i) {  
  7.                 
  8.                var test = "textOther_" + $(this).attr('id');  
  9.                resultQuiz.push({  
  10.                    Id: Id,  
  11.                    Message: 'checkbox',  
  12.                    selectedAnswerOptionID: $(this).attr('id'),  
  13.                    isotherField: $("#" + test + "").val(),  
  14.                 
  15.                })  
  16.            });  
  17.            fileData.append('resultQuiz', resultQuiz);  
  18. $.ajax({  
  19.                url: '@Url.Action("QuizTest", "Quizz")',  
  20.                data: fileData,  
  21.                processData: false,  
  22.                contentType: false,  
  23.                type: 'POST',  
  24.                success: function (data) {  
  25.                    if (data == "Tagged") {  
  26.   
  27.                    }  
  28.                }  
  29.            });  
 how to access this arraylist in action.

Answers (2)