Jquery Ajax学习实例7 Ajax所有过程事件分析示例(2)

$.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>

 

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wdsjws.html