I need to monitor all the ajax responses whether it is responding the particular value in jQuery. How to do this?
2 回答
            2        
        
		
使用该ajaxSuccess事件可能是您的解决方案:http ://api.jquery.com/ajaxSuccess/
如果你这样做:
$(document).ajaxSuccess(function(event, req, options)
{
    // handle the response
});
例如:http: //jsfiddle.net/gRoberts/NLH32/1/
于 2012-05-29T11:16:42.640   回答
    
    
            1        
        
		
您想监视以测试脚本的良好工作或监视 web 应用程序(或类似)吗?
如果是第一种情况,您可以使用 Firebug(如果您实际上没有使用它),但我认为直接不可能。也许,您可以console.log()在 AJAX 回调中添加一些(如果您将对象传递给它,它将在 Firebug 中显示所有内容)。
如果是第二个,你可以这样做:
    $.ajax({
       args
    }).done(function() { 
       // Treatment HERE !
    });
或者在 AJAX 调用之后使用 ajaxSuccess 事件。请参阅此处的文档。
于 2012-05-29T11:21:25.673   回答