Help with AJAX updatepanel

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
mbreezy
Forum Newbie
Posts: 1
Joined: Mon Feb 18, 2008 6:49 am

Help with AJAX updatepanel

Post by mbreezy »

Hey yall,

I've integrated some AJAX into my website and it's working profoundly. One problem, however.

(be advised, my site is not yet published publically so i will only describe)

Say I have a link to update a wishlist...

"Add item to wishlist"

Then the user clicks on it and it calls a PHP script, executes, and when it's done it says

"Item added to wishlist"
OR
"Item already in wishlist"

But the time between the click and the printing of the result is the problem... It takes a second or two for it to appear. How can I implement a "loading bar" image to replace that timelapse.

Now I've googled the crap out of this, but mostly what I find is AJAX pertaining to ASP. I seen a lot about UpdatePanel, but nothing pertaining to PHP.

Any help here? Snippets are welcomed as I can learn from those as well and modify; however, if a tutorial link is provided that would be just as appreciated.
User avatar
Inkyskin
Forum Contributor
Posts: 282
Joined: Mon Nov 19, 2007 10:15 am
Location: UK

Re: Help with AJAX updatepanel

Post by Inkyskin »

Within your ajax function you no doubt have something testing the ready state - if it's 4 its completed. Well you can easily make stuff happen when its not 4 aswell.

I normally have a hidden div with a loadingin animation inside it. When the readystate is not 4, show the div, otherwise hide it.
Post Reply