2 Replies - 357 Views - Last Post: 07 October 2012 - 11:38 AM

#1 ethereal1m  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 3
  • View blog
  • Posts: 214
  • Joined: 30-June 09

Creating dynamic message

Posted 07 October 2012 - 02:50 AM

Dear all,
what is the most practical way to create a dynamic message for examples, in a email application:
- when a user sends his email, an overlaying message saying "sending" appears when sending is in progress.
- when a user reloads his mailbox, an overlaying message saying "loading" appears when reloading in progress.
- After a user has sent his email, an overlaying message saying "email sent" appears for couple of seconds, then automatically vanishes.

I try to create a message that can be displayed in overlay manner in specified amount of time or process depending.

Please give me a pointer how to achieve this. I'm developing my website using PHP and Javascript.

Regards,
Ethereal1m

Is This A Good Question/Topic? 0
  • +

Replies To: Creating dynamic message

#2 Atli  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3712
  • View blog
  • Posts: 5,964
  • Joined: 08-June 10

Re: Creating dynamic message

Posted 07 October 2012 - 04:33 AM

Hey.

Using Javascript, it's fairly easy to create and position a new element so that it appears on top of the rest of the page. You can put whatever you want into such an element, including your messages. Using a library like jQuery, this is even simpler.

Here is an example of such a script, showing a "Loading" message while some data is being loaded from PHP. For reference, this is the PHP script that Javascript is loading:
<?php
header("Content-type: application/json; charset=UTF-8");

sleep(2);

echo json_encode(array(
    "First message",
    "Second message",
    "Third message",
    "Fourth message"
));



If the message is meant to be displayed for a certain amount of time, rather than while an AJAX request is finishing, the you can use window.setTimeout in place of the AJAX request to do that.
Was This Post Helpful? 1
  • +
  • -

#3 ethereal1m  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 3
  • View blog
  • Posts: 214
  • Joined: 30-June 09

Re: Creating dynamic message

Posted 07 October 2012 - 11:38 AM

Hi Atli,
thanks for the pointer...

you are great!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1