开发者

jQuery: Why 2 ajax GET requests instead of 1 request?

Why does this page have two开发者_运维百科 AJAX GET requests instead of one?

It has two requests one after another, but it must have just 1 request. Editable code can be found here.

You can check the bug in the Firebug console.


Your demo is combining AJAX-enabled tabs and a history-plugin.

It looks like the tab plugin is always loading the first tab and then loading a second tab if one is specified by the history.

The order of events is:

  • Page loads
  • First tab (aHW5jy) is requested via AJAX (1st GET)
  • History plugin restores state from URL (sees: #http://bit.ly/cKnMc2 in the URL, and then performs GET for cKnMc2)
  • 2nd AJAX request completes, result is shown.

So, to summarize the issue, you need to determine which tab the URL is requesting prior to the Tabs plugin initializing the content for any tab. It should just grab tab #3 if that's specified, whereas currently it grabs tab #1 then tab #3.


On removing initialIndex: 0, jsbin.com/ogilo/4#http://bit.ly/cKnMc2 work well on all browsers, just unfortunately is casing a new bug for IE7, IE6 after giving zero GET request for jsbin.com/ogilo/4

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜