My *.aspx Page (main page):
function getEmployeeHours(employeeId,year,month) {
$('#clocked-details').load('/Employees/GetEmployeeClockedHours/',{ 'employeeId': employeeId,'year': year,'month': month });
};
My partial view *.ascx :
<td>
<button id="btnSave" type="button" class="actionButton">
Save</button>
</td>
As above code snippet I need to accsess partial view btnSave from main view to trigger click event.
I have written below code inside the main view.
$('#btnSave').off('click').on('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;
});
But it doesn't fire.Here I am using load jquery method to load my partial view asynchronously.
So my question is how should I fire click event of partial view ?