压倒第三方JS

Dot*_*ude 6 javascript jquery

我们使用第三方控件套件,它有一个ajaxError我们想要自定义的JQuery全局事件.我们不想更新这个JS文件,但希望以某种方式覆盖它,以便JQuery不执行此事件.

这可能吗?

编辑:第三方代码

    ajaxError: function (element, eventName, xhr, status) {
        var prevented = this.trigger(element, eventName,
            {
                XMLHttpRequest: xhr,
                textStatus: status
            });

        if (!prevented) {
            if (status == 'error' && xhr.status != '0')
                alert('Error! The requested URL returned ' + xhr.status + ' - ' + xhr.statusText);
            if (status == 'timeout')
                alert('Error! Server timeout.');
        }
    }
Run Code Online (Sandbox Code Playgroud)

我想从if条件开始使行无效

nom*_*ash -1

public class MyClass: MC

{
  protected override void OnError(..)
  {
     //handle error, send error to where ever
  }
}
Run Code Online (Sandbox Code Playgroud)