使用默认的ajax发布而不是使用自定义发布处理程序:
http://jsfiddle.net/AT5vt/1/
$('body').ajaxSuccess(function() { alert('global success'); });$('body').ajaxError(function() { alert('global error'); });$.ajax({ type: 'POST', url: 'http://www.google.com', data: { name: "John", time: "2pm" } , complete: function(data,s,xhr) { if(xhr.status == 200) { alert('local success'); } else { //note you can catch a lot of errors here like 404, 500, 406, 302 etc alert("local error"); } }})并未将其放在jsfiddle中,因为从那里发布到google.com的操作一直在失败,但这应该可行。



