var d=0;
function checkhrsforDate(){
var date=$('#approveapplieddate').val();
$.ajax({
url: "datelogic.php",
type: "post",
data:'date='+date,
cache: false,
success:function(htmlData){
if(htmlData=='')
{
d=0;
}
else{
d=htmlData;
}
return d;
}
});
}
$(document).ready(function(){
$("#approveappliedhrs").onkeyup(function (e) {
var approvedate=$('#approvedate').val();
var approveapplieddate=$('#approveapplieddate').val();
appliedhrs=$("#appliedhrs").val();
hrs=parseInt($(this).val());
if($(this).val().length==1){
checkhrsforDate();
}
});
});
First time it showing d value as 0 and next key press it's working fine. But my textbox allows only one value. is it possible to call AJAX call in keyup event