function loadPNRStatus(){ var searchN = $(‘#PNR_NUM’).val(); if(searchN !=””){ $.ajax( { type: “POST”, url: “getPNRStatus.php”, data:{pnrQ: searchN }, beforeSend: function() { $.blockUI({ css: { border: ‘none’, padding: ’15px’, backgroundColor: ‘#000’, ‘-webkit-border-radius’: ’10px’, ‘-moz-border-radius’: ’10px’, opacity: .5, color: ‘#fff’ } }); }, success:function(htmlResp) { $(‘div.pnrStatusLoad’).html(htmlResp); $.unblockUI(); } }); } }
// if enter key pressed after pasting/typing PNR status Ajax method will be called
$(‘#PNR_NUM’).on(‘keypress’, function (event) {
if(event.which === 13){
loadPNRStatus();
}
// return false if user enters other than numbers
if (event.which != 8 && event.which != 0 && (event.which < 48 || event.which > 57)) {
//display error message
return false;
}
});