Forum Moderators: open

Message Too Old, No Replies

javascript + ajax + loading message

         

smagdy

1:38 pm on Nov 8, 2005 (gmt 0)

10+ Year Member



hi,
i ve javascript code that calls ajax php code that creates & fills select menu so i want to display loading message cuz its big menu so it takes bet 1-3 seconds to b displayed.

so my problem after i display the "loading message" is that i cant know when the ajax php function have finished to set the loadin message to display:none......

javascript function:

if user choosed this
{
set load message to inline;
call ajax function();
set load message to none;
}

so this code set the load mess. to inline then none BEFORE the ajax function finish loadin cuz its workin in the background!

hope someone got me and can help..

thanks in advance

whoisgregg

5:30 pm on Nov 8, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I *think* this should work (it works for <img> tags).

<select onload="loaded(this)" ....

whoisgregg

7:51 pm on Nov 8, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hmm, while reading a different thread (msg #15) [webmasterworld.com], Bernard Marx points out that

onload only works for the window, images and occasionally frames.

So, please disregard my earlier suggestion. :(

Bernard Marx

7:58 pm on Nov 8, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Er yes. Slight malfunction at this end.

Nice to see someone's got their eye on the ball.

smagdy

7:59 pm on Nov 8, 2005 (gmt 0)

10+ Year Member



ohhh i was just going to try it out.....

so what is the solution now!

Bernard Marx

10:41 pm on Nov 8, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well..

You are presumeably using an asynchronous request, so you can put your message hiding statement(s) inside a callback function that is called by the onreadystatechange event

[jibbering.com...]