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 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

Ask A Question

Stats

  • Questions 340k
  • Answers 340k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Your point is good, but your code wouldn't even compile,… May 14, 2026 at 4:45 am
  • Editorial Team
    Editorial Team added an answer This tool looks like it might be what you're after. May 14, 2026 at 4:45 am
  • Editorial Team
    Editorial Team added an answer The connection string in your app.config (data layer) is not… May 14, 2026 at 4:45 am

Related Questions

I am considering releasing one of my class libraries written in C# as open
Given the following models (cut down for understanding): class Venue(models.Model): name = models.CharField(unique=True) class
I'm looking for a way to serialize a POCO that contains some read-only properties.
In the following HTML, I'd like the frame around the image to be snug
I want to add some jQuery functionality to our sites where one piece of

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.