Javascript Ajax代码,用于在网页不显示时显示注释/信息框';t载荷

Javascript Ajax代码,用于在网页不显示时显示注释/信息框';t载荷,javascript,jquery,ajax,Javascript,Jquery,Ajax,我有下面的代码 <script> function AjaxLoadFWs() { var sPath = window.location.pathname; var sPage = sPath.substring(sPath.lastIndexOf('/') + 1); $('#overviewfw').load("http://test.com/test.asp"); change_overview();

我有下面的代码

<script>
    function AjaxLoadFWs() {
        var sPath = window.location.pathname;
        var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);

        $('#overviewfw').load("http://test.com/test.asp");
        change_overview();
        change_overview_detail();
    }
</script>

函数AjaxLoadFWs(){
var sPath=window.location.pathname;
var sPage=sPath.substring(sPath.lastIndexOf('/')+1);
$('#概览fw')。加载(“http://test.com/test.asp");
更改_概述();
更改概述和详细信息();
}
现在,如果没有在10秒内加载,我需要显示一条消息

需要添加哪些代码?

调用
.load()
.ajax()
的一种方便快捷的方法。由于您需要10秒的
超时
,我建议改用
ajax
,因为它提供了更多选项:

$.ajax('http://test.com/test.asp', {
   timeout: 10000, // 10 seconds
   success: function(data, textStatus, jqXHR) {
      //here you have to process the data you get
   },
   error: function(jqXHR, textStatus, errorThrown) {
      //here you can handle the timeout.
   }
});

请写下你试过什么