When i click the Select working days / hours Checkbox the list of days will be displayed. for example if i click the sunday checkbox check box the value entered in the checkbox should be call to javascript function. in case am not click the checkbox the value display should be Null.
https://jsfiddle.net/ivinraj/9z6ttkvo/2/
$(document).ready(function () {
$("input#btnDocBusinesshours").click(function () { SaveDocBusinesshours(null) });
});
Call Ajax Function
function callAjax(jparms) {
$.ajax({
type: "POST",
url: jparms.url,
data: jparms.data,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
if (jparms.action == "SaveDocBusinesshours")
SaveDocBusinesshours(response.d)
},
failure: function (response) { response.d; }
});
}
Save Ajax Function
function SaveDocBusinesshours(response) {
var values = $('input[type="checkbox"].single:checked').map(function () {
return $(this).val();
}).toArray();
if (response == null) {
callAjax({
url: pageUrl + '/SaveDocBusinesshours',
data: '{"Doctorid": "' + $("#<%=hdnDoctorId.ClientID %>").val() + '","WorkingDaysID" : "' + $("#<%=hdnBusiness.ClientID %>").val() + '","Sunday" : "' + $("#<%=ChkSUN.ClientID %>").val() + '","Monday" : "' + $("#<%=ChkMON.ClientID %>").val() + '","Thuesday" : "' + $("#<%=ChkTUE.ClientID %>").val() + '"}',
action: "SaveDocBusinesshours"
});
window.location.reload();
}
else {
loading(false);
if (response.AjxContactId != null) {
$('#<%=hdnBusiness.ClientID%>').val(response.AjxContactId);
}
msg(true, response.Message);
}
}
[WebMethod]
public static UserAjax SaveDocBusinesshours(string Doctorid, string WorkingDaysID, string Sunday, string Monday, string Thuesday)
{
UserAjax oUserAjax = new UserAjax();
return oUserAjax;
}