views:

74

answers:

2

Why http://jsbin.com/ogilo/3#http://bit.ly/cKnMc2 has 2 ajax GET requests instead of 1 request?

It has requests http://bit.ly/aHW5jy and http://bit.ly/cKnMc2 one after other. It must have just 1 request. Editable code in http://jsbin.com/ogilo/3/edit

You can check the bug in Firebug console

A: 

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.

STW
since you're using jQuery extensions from flowplayer, why not try researching if others have already combined these two functions successfully?
STW
already tried, also I asked for issue from jquery tools author too
Binyamin
It looks like it's normal behavior with that library. Their demo page with AJAX + History tabs shows the same behavior: http://flowplayer.org/tools/demos/tabs/ajax-history.html#ajax2.htm
STW
I post this bug also in http://github.com/jquerytools/jquerytools/issues/issue/187
Binyamin
fyi -- if jQueryUI is an option, then it looks like it supports specifying the initially selected tab via the 'selected' option. Not sure if it works in combination with their AJAX tabs, but just bumped into it and wanted to mention it.
STW
A: 

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

Binyamin