Welcome Guest, Not a member yet? Register   Sign In
loading image while fetching data
#1

[eluser]CocoMansur[/eluser]
Hi, I have this script code that i got from 1 of the tutorials regarding codeigniter with ajax, is it possible to have a loading image while it fetches data on the database?

Code:
[removed]
  $(".testiNext").click(function(){
   var form_data = {
    testiNext: '<?=$offsetNext;?>',
    };
  $.ajax({
   url: "<?=site_url('main/testi_ajax');?>",
   type: 'POST',
   data: form_data,
   success: function(testi){
    $("#testimonials").html(testi);
   }
   });
  return false;  
});
[removed]
#2

[eluser]Otemu[/eluser]
You could use beforeSend function to load the image

Code:
beforeSend: function() {
           ....load image
        },
success: function(testi){
    .... remove loading image
    $("#testimonials").html(testi);
   }
#3

[eluser]Sanjay Sarvaiya[/eluser]
Yes it's possible to have a loading image while fetching data.

Code:
$(".testiNext").click(function(){
$("#testimonials").html('<img src="path of loading image">');
......
......




Theme © iAndrew 2016 - Forum software by © MyBB