// for limit clicks searchClick = 0; // if come with number $("#number").val(); search_tretment(); // search for tretment $(function() { $("#search_tretment").click(function() { search_tretment(); }); }); $('.clickfun1').keypress(function (e) { var key = e.which; if(key == 13) { search_tretment(); } }); function search_tretment() { if ($("#number").val().length !== 9) { swalfun('حدث خطأ', 'رقم الجوال يجب أن يتكون من 9 أرقام وبدون 0 في البداية', 'error'); return false; } var tretmentNumber = $("#number").val(); let branch_id = ; var emp_id = ; var booking_day_date = ; var booking_day_time = ; if (searchClick == 0) { searchClick++; $.post("work/order/ajax/get_tretment_ajax.php", { tretmentNumber, branch_id, emp_id, booking_day_date, booking_day_time, }, function(get_tretment) { $("#get_tretment").html(get_tretment); }) } else { swalfun("يرجى الانتظار","", "warning"); } }