(073)jquery_异步_ajaxStart_ajaxStop
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html> <head> <title>ajax_ajaxStart.html</title> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="this is my page"> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <!--<link rel="stylesheet" type="text/css" href="./styles.css">--> <style type="text/css"> #divtest { width: 282px; } #divtest .title { padding: 8px; background-color:Blue; color: #fff; height: 23px; line-height: 23px; font-size: 15px; font-weight: bold; } ul { float: left; width: 280px; padding: 5px 0px; margin: 0px; font-size: 14px; list-style-type: none; } ul li { float: left; width: 280px; height: 23px; line-height: 23px; padding: 3px 8px; } .fl { float: left; } .fr { float: right; } #ajaxDiv { float:right; } </style> <script type="text/javascript" src="../js/jquery/jquery-1.8.3.min.js"></script> <script type="text/javascript"> $(function(){ $("#ajaxDiv").ajaxStart(function(){ $(this).html("ajax start"); }); $("#ajaxDiv").ajaxStop(function(){ $(this).html("ajax stop"); }); $("#btnShow").bind("click",function(){ $.ajax({ url:"http://localhost:9090/JQuery/servlet/TestServlet", dataType:"json", success:function(data){ $("#divload").append(data.name + "</br>"); $("#divload").append(data.say + "</br>"); } }); }); }); </script> </head> <body> <div id="divtest"> <div class="title"> <span class="fl">加载一段文字</span> <span class="fr"> <input id="btnShow" type="button" value="加载" /> </span> </div> <ul> <li id="divload"></li> </ul> <div id="ajaxDiv"></div> </div> </body> </html>
ajaxStart()和ajaxStop()在jquery1.9.0后不能使用
***万事万物都有裂痕,那是光照进来的地方***

浙公网安备 33010602011771号