Saturday 15 May 2010

ajax - adding loading status in jquery toogle -


I have a link that will be loaded when a user clicks on the content from another page. I'm using jquery. It works fine, but I want to show loading position if it takes time to load. It would be better if the user is seeing something, then I want to click on the link that

" Please Wait .. "

Unless the content is completely full

This is my code.

  & lt; Script type = "text / javascript" & gt; $ (Function () {$ ('# view') Toggle (function () {var href = $ (this) .attr ('href'); $ ('# load'). Hide (). FadeIn () $ ('# View'). ('Hide'); return;}, function () {$ ('# load'). Hide (); $ ('# view'). Text ('see description'); });}); & Lt; / Script & gt; Callback in. By using load () you can actually help in getting what you want. . Here's an example:  
  & lt; Script type = "text / javascript" & gt; $ (Function () {$ ('# view') Toggle (function () {var href = $ (this) .attr ('href'); $ ('# view'). Text ('please wait. $ ('# Load'). $ ('# Load') Hide (). FadeIn () .load (href, function () {$ ('# view'). Text ('hide');}); Return false;}, function () {$ ('# load'). Hide (); $ ('# view'). Text ('see description');})}}); & lt; / scripts & gt; ;    

No comments:

Post a Comment