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

  • Home
  • SEARCH
  • 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 654353
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:29:06+00:00 2026-05-13T22:29:06+00:00

So I want to do look a like stackoverflow with the message at the

  • 0

So I want to do look a like stackoverflow with the message at the top.

Now I have all configured and such, but I got one problem.. The message only displays 1st time, second time it doesn’t appear.

I know why, something about every id must be unique or something in a div.. And then I’ve used rand(1, 300); (php) and it still won’t work.

Here’s my codes:

function checkSession(){
    $.ajax({url: "session.php", success: function(data){
         if( data == 1){
            var postFilen = 'msg.php';
            $.post(postFilen, function(data){
            $(".msg").html(data).find(".message2").fadeIn("slow")
            setTimeout(function(checkSession) {
    $('.msg').fadeOut('slow');
}, 10000);
            });  
         }else{ 
             $('.message2').hide();
         }
    }});
// setInterval('checkSession()',1000);
}

index.php:

<div class="msg" id="msg" ></div>

msg.php:

<div class="message2" id="message2" onclick="closeNotice2()" style="display: none">
Yo, <b><? echo $pusername; ?></b> - <? echo $_SESSION["user_message"]; ?> 
<a class="close-notify" onclick="closeNotice2()">X</a>
</div> 

CloseNotice2() – (just in case if you want to see that too):

function closeNotice2() {
    $(".message2").fadeOut("slow");
} 

session.php:

if(isset($_SESSION['user_message'])) {
echo 1; 
}

CSS:

.message2 {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 105; /* Anything higher than 1 will do */
    background-color: #034678; 
    font-family: Arial,Helvetica,sans-serif;
    font-size: 100%;
    text-align: center;
    font-weight: bold;
    border-bottom: 2px solid #FFF;
  height: 26 px;
  width: 100%;
}
.message2 span {
    text-align: center;
    width: 95%;
    float:left;
}

I think that’s all. Hope you can help me out.

  • 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-13T22:29:06+00:00Added an answer on May 13, 2026 at 10:29 pm

    Finally i found out the error myself, and it was the timeout() function, inside the checksession(); .. It works like a charm now 🙂

    I just needed to remove this:

    setTimeout(function() {
        $('.msg').fadeOut('slow');
            }, 5000);
    

    I dont know how to fix this, but i will ask in another question because i find this answered now! But thanks henchman and Alan, for taking your time to try to answer me

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

Sidebar

Related Questions

I want to create an NSOutlineView subclass where some of the entries look like
I have 2-3 different column names that I want to look up in the
I am using .Find to look for a string, but the cells I want
I want to change the standard 3D look of the standard asp.net checkbox to
ssh will look for its keys by default in the ~/.ssh folder. I want
I want to write tests for my app, though each time I look at
I am using a set because, i want to use the quick look up
Want to know what the stackoverflow community feels about the various free and non-free
I would like to have a search box integrated into a nav bar that
I'd like to find (using javascript) all of the references to image links on

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.