How can i set wait time for this function.
function UpdateMedicaitonHistory(data) {
MedicaitonHistoryGrid();
//set a wait time to finish MedicaitonHistoryGrid() like for 3 seconds
// then execute the below code.
if ($("#MedHistoryGridSec").is(":visible")) {
alert("yes we have grid");
}
else{
alert("No Grid");
}
}
You can use setTimeout
:
setTimeout(function()
{
if($('#MedHistoryGridSec').is(':visible'))
alert('yes');
else
alert('no');
}, 3000);