Jquery Ajax example code to animate before loading data

  • 2020-03-30 01:39:08
  • OfStack


$(document).ready(function(){
     $.ajax({
        type:"get",
        cache:false,
        url:"ajaxpage.aspx?t=getcity",
        dataType:"json",
        beforeSend:function(){
           $("#vvv").append('<img src="../../images/loading.gif"  />');
        },
        success:function(data){
           $("#city").html(data.info);//Add options to the drop-down box
        },
        complete: function() {$("#vvv").remove();
        }
     })
})


Related articles: