0

如果我的页面包含以下内容:

1. HTML with text and images.
2. Lots of reference to CSS and Large JS Files.
3. Within HTML a call similar to one below:

$(document).ready(function () {
     $.ajax({
      url: "http://fiddle.jshell.net/favicon.png",
      beforeSend: function( xhr ) {
        xhr.overrideMimeType( "text/plain; charset=x-user-defined" );
      }
    })
      .done(function( data ) {
        if ( console && console.log ) {
          console.log( "Sample of data:", data.slice( 0, 100 ) );
        }
      });
      }

有人可以澄清一下我的理解是否正确,首先加载哪个?

  1. 加载所有 HTML 和图像。
  2. 加载 CSS 并应用 CSS 样式
  3. 然后,调用 $.ajax 调用。
  4. 渲染整个页面。
4

1 回答 1

1

ready保证在 DOM 准备好后被调用,仅此而已。这绝对不会加载“所有 HTML 和图像”,特别是图像可能已加载或未加载。

于 2013-12-05T06:01:53.717 回答