I've created a global handler for ajaxSuccess
, but I need to be able 开发者_StackOverflow社区to examine the data for each request. Is it possible to access the returned data at this point?
jQuery(document).ajaxSuccess(function(event, request, options) {
// i can has the datas? >^..^<
});
This works in FF, Chrome, IE 8:
jQuery(document).ajaxSuccess(function(event, request, options) {
if (options.dataType == 'json') {
var data = JSON.parse(request.responseText);
// i has the datas!
}
});
jQuery(document).ajaxSuccess(function(event, request, options, data) {
console.log(data);
});
精彩评论