![]() |
Loading Gif
I am using ajax to call upon an external page during page load and after page load. these are the codes I am using:
Code:
<script type="text/javascript"> |
You can use .ajaxSetup() in combination with beforeSend. Put this before your first $.ajax() call
Code:
$.ajaxSetup({ |
two questions, how do I stop it once loaded, and currently, it only is animating after the ajax loads, not while it is loading.....is this how it should look?
<script type="text/javascript"> $.ajaxSetup({ beforeSend: function() { $('#bo').html('<img src="pics/loadingAnimation.gif" />'); } }); $(function(){ $.ajax({ type:"POST", url:"news_load1.php", data:"getNews=true", success: function(r){ $("#newsContent").html(r) }, error: function(){ alert("could not retrieve any news articles"); } }) }) |
I would
1) pre-load the image so that it is ready before the ajax requests starts 2) show the gif in the #newsContent element instead of the #bo element. This would automatically stop the loading gif by overwriting the #newsContent in the success callback Code:
$(document).ready(function() { |
now nothing is happening....no image, no ajax load, no nothing....
Code:
$(document).ready(function() { |
oh and by the way, the first function runs when the page loads....it loads the newsContent.
|
Are the "..." dots still part of your code?
|
no they aren't anymore, sorry, it does "work" now. by that I mean the image shows, but it still isn't animated and it also isn't disappearing when done....even if it is with the newsContent....
|
it's just getting pushed below the ajax conten
|
it goes away if I use activate one of the other functions, but it doesn't show up tho then.
|
| All times are GMT +1. The time now is 10:04 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.