

Above I have showed the my dynamic UI and the way I set the ids dynamically for the relevant fields according to the date.
So I need to send theses data into MVC controller as a array ajax post and then pick those things inside the controller.This should be happened when I click Save button
My post method is as below (without above array details):
$("#clocked-details").find("#btnSave").die('click').live('click', function () {
var yearValue = $("#year").val();
var monthValue = $("#month").val();
$.ajax({
url: "/Employees/UpdateEmployeeClockedHoursByProvider",
type: 'POST',
cache: false,
data: { employeeId: employeeId, year: yearValue, month: monthValue },
success: function (result) {
},
error: function (xhr, ajaxOptions, thrownError) {
alert(xhr.status);
alert(thrownError);
}
});
return false;
});
My controller is as below (without jquery array maupulation) :
[HttpPost]
public void UpdateEmployeeClockedHoursByProvider(Guid employeeId, int year, int month)
{
}
Update
UI has been generated by using below mentioned code :
<% foreach (var ec in Model)
{%>
<tr>
<td>
<%: ec.ClockedDate.ToString("yyyy-MM-dd") %>
</td>
<td>
<input type="number" id="<%: ec.ClockedDate.ToString("yyyy-MM-dd") %>-hours" name="<%: ec.ClockedDate.ToString("yyyy-MM-dd") %>-hours"
class="total-hours" placeholder="Hours" value="<%: ec.TotalHours %>" />
</td>
<td>
<input type="number" id="<%: ec.ClockedDate.ToString("yyyy-MM-dd") %>-minutes" name="<%: ec.ClockedDate.ToString("yyyy-MM-dd") %>-minutes"
class="total-minutes" placeholder="Minutes" value="<%: ec.TotalMinutes %>" />
</td>
</tr>
<% }%>
My Questions :
How to send above dynamic 2 fields per row data by using ajax ?
How to manipulate that array inside the controller ?
idwhich is say2013-03-08?data: $('tr').serialize()gets all the input values under every row into ur Ajaxdatavariable