1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2017
    Rep Power

    Help with Ajax/Java -hiding/unhiding divs

    Hi guys,

    Ive just built a shopping cart type functianlity (using php).

    Ive got to the part where a user adds something into their shopping basket. They click ADD TO BASKET, and if successfull a div tag called "status_text" shows the
    'success' message.
    3 seconds after the message appears I have written this into my code to make is disappear after 3 seconds

    $('#status_text').fadeOut('fast');}, 3000);
    This is that the success message only briefly displays.

    However if the user then presses the ADD TO BASKET button again (adding a second identical item into their basket), the button functionality works in that it does add
    the item to the basket but the success message "#status_text" will not appear a second time.

    How would I make it so that this div tag does not disappear altogether and allows to show up a second+ time?

    This is my code...

                                      success: function(data,status, xhr)
                                                      setTimeout(function() {
                                                      $('#status_text').fadeOut('fast');}, 3000);
  2. #2
  3. Backwards Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Washington, USA
    Rep Power
    Make sure you're showing the #status_text in the first place.

IMN logo majestic logo threadwatch logo seochat tools logo