Bootstrap Modal Remote Source Error Handling

后端 未结 3 1032
自闭症患者
自闭症患者 2021-01-17 11:58

We are using Bootstrap Modal window to display some html that is loaded via a remote source. We\'re doing this via the recommended way in the Bootstrap

3条回答
  •  庸人自扰
    2021-01-17 12:32

    You may want to implement a Global Ajax Error Handler in your app, this will attach to every Ajax request that is performed, implementation would look something like this:

    $( document ).ajaxError(function( event, jqxhr, settings, exception ) {
      //Since this handler is attach to all ajax requests we can differentiate by the settings used to build the request
      if ( settings.url == "index.html" ) {
        //Handle error
      }
    });
    

    You can read more about Global Ajax Handlers here

提交回复
热议问题