Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 840171
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T05:34:53+00:00 2026-05-15T05:34:53+00:00

i am using php,mysql,jquery. When a user clicks on save i go to back

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T05:34:54+00:00Added an answer on May 15, 2026 at 5:34 am

    Disable button for 1 second:

    if (success) {
     $('#buttonid').attr('disabled', 'disabled');
     setTimeout(function() { $('#buttonid').attr('disabled', ''); }, 1000);
    }
    

    EDIT about keeping track of browser reloads
    You can easily access cookies with the jQuery plugin: http://plugins.jquery.com/project/cookie

    if (success) {
     $('#buttonid').attr('disabled', 'disabled');
     setTimeout(function() { $('#buttonid').attr('disabled', ''); }, 1000);
     $.cookie('disabledTime', (new Date()).getTime());
    }
    

    Then read it upon loading the DOM:

    $(document).ready(function() {
      if ($.cookie('disabledTime') > 0) {
        var remainingTime = (new Date()).getTime() - $.cookie('disabledTime');
        if (remainingTime > 0) {
           $('#buttonid').attr('disabled', 'disabled');
           setTimeout(function() { $('#buttonid').attr('disabled', ''); }, remainingTime);
        }
      }
    });
    

    Note that I didn’t test this, but you get the idea

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently using PHP/MySQL and the jQuery timeago plugin. Basically, I need to
I am using JQUERY .ajax() to send serialized form data to MySQL using PHP.
I'm building this application using PHP, MySQL and jQuery. Essentially it's a checklist management
I am working on a filter functionality using ajax/jquery and php/mysql.I have two sets
Here's my situation: using PHP and MySQL as my backend, jQuery and jsTree for
I'm using PHP, jQuery and mySQL to build an admin site to my webpage.
I'm getting ready to use the JQuery-based FullCalendar in my online app using PHP/MySQL
I'm trying to post some very simple data to a php file using jquery
I'm using jQuery AJAX to grab some data from a PHP page and using
We have a jquery/php/mysql system that allows a user to log in and review

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.