<script language="javascript" type="text/javascript"> $.ready(function BtnSpareClick() { $.ajax({ type: "get", url: "https://www.jb51.net/windy2008/rss", data: {}, global: false, beforeSend: function(data, status, settings) { $("#Process").text("Part请求开始前"); alert($("#Process").text()); }, success: function(data, status, settings) { $("item", data).each(function(i, domEle) { $("#Result").append("<div>" + $(domEle).children("title").text() + "</div>"); }); $("#Process").text("Part请求成功时"); alert($("#Process").text()); }, complete: function(data, status, settings) { $("#Process").text("Part请求完成时"); alert($("#Process").text()); }, error: function(data, status, settings) { $("#Process").text("Part请求错误时"); alert($("#Process").text()); } }); });
</script> |
<script language="javascript" type="text/javascript">
$.ready(function BtnGlobalClick() { $.get("https://www.jb51.net/windy2008/rss", {}, function(data, status, settings)
{ $("item", data).each(function(i, domEle) { $("#Result").append("<div>" + $(domEle).children("title").text() + "</div>"); }); }); $("#Process").ajaxStart(function() { alert($(this).text()); $(this).text("开始新的Ajax请求"); }); $("#Process").ajaxStop(function() { $(this).text("当没有Ajax正在进行中的时候"); alert($(this).text()); }); $("#Process").ajaxSend(function() { $(this).text("请求开始前"); alert($(this).text()); }); $("#Process").ajaxSuccess(function() { $(this).text("请求成功"); alert($(this).text()); }); $("#Process").ajaxComplete(function() { $(this).text("请求完成时"); alert($(this).text()); }); $("#Process").ajaxError(function() { $(this).text("请求错误时"); alert($(this).text()); }); }); </script> |