hi, i am using php,mysql,jquery.
When a user clicks on save i go to back end and save data and show the response. once show the success i need to disable the save button for say 1 min. how do i do it.?
here is ma code
$(document).ready(function() {
if ($.cookie('<?php echo $userId ?><?php echo $product ?><?php echo $alias ?>agreedisabledTime') > 0) {
var remainingTime = (new Date()).getTime() - $.cookie('<?php echo $userId ?><?php echo $product ?><?php echo $alias ?>agreedisabledTime');
if (remainingTime < <?php echo $timer ?>) {
//if (remainingTime < 7200) {
$('#agree').attr('disabled', 'disabled');
$('#disagree').attr('disabled', 'disabled');
setTimeout(function() { $('#agree').attr('disabled', ''); }, remainingTime);
setTimeout(function() { $('#disagree').attr('disabled', ''); }, remainingTime);
}
}
$('#agree').click(function()
{
$('#response').show();
$.post('/all_include_files/increment.php',{update:'agree',product:"<?php echo $product?>",alias:"<?php echo $alias ?>"},function(data)
{
if(data.indexOf('ERROR') < 0)
{
$('#response').hide();
$('.agree_number').html(data);
alert('Thanks for your esteemed opinion');
$('#agree').attr('disabled', 'disabled');
$('#disagree').attr('disabled', 'disabled');
setTimeout(function() { $('#agree').attr('disabled', ''); }, "<?php echo $timer ?>");
setTimeout(function() { $('#disagree').attr('disabled', ''); }, "<?php echo $timer ?>");
$.cookie('<?php echo $userId ?><?php echo $product ?><?php echo $alias ?>agreedisabledTime', (new Date()).getTime());
}
else
{ alert(data); }
});
});
});
where $timer is set to 120000