Pass the link to the button and disable it, and then when ajax finishes, enable it again if necessary.
<button type="button" href="javascript:;" class="btn btn-primary" onclick="jobResponse(this, 'yes',<?php echo $myjobs['id_job'];?>)"> Subimt</button>
<!-- ----------------^^^^----
<script type="text/javascript">
function jobResponse(ele, res, jobId) {
var frm_data = {
res: res,
jobId: jobId
};
$(ele).prop('disabled', true);
$.ajax({
complete: function() {
$(ele).prop('disabled', false);
}
});
}
</script>
source
share