Article: ASP.Net MVC: Save Form data to Database using jQuery AJAX
$(document).on("click", ".ask-update-bth", function () {
console.log("Button clicked");
$("#deploy_tbl_1.patientrow").each(function () {
console.log("Table row processing");
//var tr = $(this);
var tr = $(this).closest("tr");
var get_room_value = $(tr).children("td").eq(0).text();
/*alert(get_room_value);*/
//var get_bedno = $(tr).children("td").eq(2).text();
//alert(get_bedno);
var get_name = $(tr).find(".ps").attr("name");
/*alert(get_name);*/
var emp_id_value = $(tr).find(".empId_input").val();
/*alert(emp_id_value);*/
var ps_checked_value = $('input[name="' + get_name + '"]:checked').val();
/*alert(ps_checked_value);*/
var updated_time = $(tr).find(".HK_Performed_time_input").val();
alert(updated_time);
// console.log(ps_checked_value);
if (ps_checked_value == "undefined") {
alert("Please select the Physical Status");
}
else if (emp_id_value == "") {
alert("Please select the Employee");
}
else {
$.ajax({
url: ROOT + "Admission/UpdateFloorDeploymentDetails",
data: { roomId: get_room_value, empId: emp_id_value, physicalStatus: ps_checked_value },
type: "GET",
contentType: "application/json;charset=utf-8",
dataType: "json",
success: function (result) {
alert(result);
window.location.reload();
},
error: function (errormessage) {
alert(errormessage.responseText);
}
});
}
});
alert("Updated Successfully");
/*window.location.reload();*/
console.log("Code execution completed");
});