0

I send Request to Get Html Content and Replace With Another Content.

This is My jQuery Code.

 $.post(page,function(data){
      $('.page_content').html(data);
 });

and i also used this code to send request but not working i got same problem.

$.ajax({
    url:page,
    method:'POST',
    async:true,
    success: function(data){
        $('.page_content').html(data);
    }
});

and i used the $.ajaxStart and $.ajaxStop for hide and show GIF Loading.

 $(document).ready(function(){
      $( document ).ajaxStart(function() {
             $( ".page_loading" ).show();
      });
      $( document ).ajaxStop(function() {
             $( ".page_loading" ).hide();
      });
 });

This code is Working fine in Mozila but this code is not working on chrome or safari.

in chrome or safari the GIF loading is stop animation.

i used This GIF for Loading.

http://4.bp.blogspot.com/-j9gMlFkdLvw/Tp1ZdBf0L5I/AAAAAAAAA6c/igXiNrSqqgA/s400/loading-gif.gif

Please check this is working in Mozila but chrome and safari is not animated is stop animation.

Thank you.

Renish Khunt
  • 5,620
  • 18
  • 55
  • 92

2 Answers2

0

I haven't found it documented anywhere, but my experience is when webkit begins a page transition, it starts reclaiming memory from the current page by stopping GIF animations and preventing some page redraws. Presumably this is to reduce overall memory usage while rendering the next page. I've found that you can work around it with smaller (file size) GIFs.

Brady Emerson
  • 4,769
  • 1
  • 15
  • 17
0

Firstly, try not to directly link to that url in blogspot. host the image on same server so it load fast and blogspot url might change later or it might even not load for others.

Second, I think the GIF stops because on your document ready you immediately run ajax, why not use a SetTimeout() to delay it a bit.

Also your HTML response ($('.page_content').html(data);) might have too many htmls, so it makes browser busy and it doesnt play GIF temporarily or looks like it "hangs"

fedmich
  • 5,343
  • 3
  • 37
  • 52