Display loading image while post with ajax

前端 未结 7 1838
野趣味
野趣味 2020-12-07 17:18

I know there are thousands of examples on the internet, but I want for the script I already have to display a loading gif image while the data is retrievedd. My java knowled

7条回答
  •  广开言路
    2020-12-07 17:54

    //$(document).ready(function(){
    //	 $("a").click(function(event){
    //		event.preventDefault();
    //		$("div").html("This is prevent link...");
    //	});
    //});			
    
    $(document).ready(function(){
    	$("a").click(function(event){
    		event.preventDefault();
    		$.ajax({
    			beforeSend: function(){
    				$('#text').html(" Loading...");
    			},
    			success : function(){
    				setInterval(function(){ $('#text').load("cd_catalog.txt"); },1000);
    			}
    		});
    	});
    });
    
    		
    [click to redirect][1]
    

提交回复
热议问题