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
Creating dynamic message
Page 1 of 12 Replies - 186 Views - Last Post: 07 October 2012 - 11:38 AM
Replies To: Creating dynamic message
#2
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:
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.
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.
#3
Re: Creating dynamic message
Posted 07 October 2012 - 11:38 AM
Hi Atli,
thanks for the pointer...
you are great!
thanks for the pointer...
you are great!
Page 1 of 1
|
|

New Topic/Question
Reply


MultiQuote




|