i have a loop like this in my view that generates the list of student`s names
<Table id="your_table">
<thead>
<tr>
<th>name</th>
<th>grade</th>
<th>remove</th>
</tr>
</thead>
<tbody>
@foreach (string item in Model)
{
<tr>
<td id="td_name" style="border-left: thin">@item</td>
<td><input type="text" id="txtGrade_@item" onclick="" style="width: 40px;border-left: thin" /></td>
<td><input type="checkbox" id="chkStudent_@item" value="@item" /></td>
</tr>
}
</tbody>
i use the script below to get the text for the first cell of each row :
$('#btnDone')
.click(function() {
//get studentslist
function getFirstCellTextList(tableElement) {
if (tableElement instanceof jQuery) {
// Create an array
var textList = [];
// Iterate over each table row
tableElement.find('tbody tr').each(function () {
// Get the first cells's text and push it inside the array
var row = $(this);
if (row.children('td').length > 0) {
textList.push(row.children('td').eq(0).text());
}
});
return textList;
}
return null;
}
// Get the array
var lststudents = getFirstCellTextList($('#your_table'));
var result = [];
$(lststudents).each(function(index, item) {
result.push(item);
});
alert(result);
$.ajax('/TeacherPages/GetGrades/' + result).done(function () {
alert("done");
});
});
the problem is. when i want to send the created array to the controller i get error 404. there is something wrong with this array. because when i manually add values to the array the ajax works without any problems
this is my action:
[AttributeRouting.Web.Mvc.GET("/TeacherPages/GetGrades/{result}")]
public PartialViewResult GetGrades(string[] result)
{
return PartialView();
}

$.ajax('@Url.Action("GetGrades","TeacherPages")'and show your action how it looks like?/TeacherPages/GetGrades?name=ABC&name=DEF&name=etcif you method had a parameter `IEnumerable<string> name. What does you array look like?result