Skip to content

Activate tab fires twice with AJAX tabs, cache set to false #35

@bknoles

Description

@bknoles

I've got AJAX'd tabs up and running in my project, but I'm having a weird issue where the tab loads twice when the link is clicked. Using the chrome developer tools, it looks like the second call is due to a hash change.

Here is the original call stack:

jQuery.ajaxTransport.send                                        jquery.js:8103
jQuery.extend.ajax                                               jquery.js:7581
jQuery.fn.extend.load                                            jquery.js:7024
$.easytabs.activateTab                                   jquery.easytabs.js:546
$.easytabs.plugin.selectTab                              jquery.easytabs.js:213
$.easytabs.bindToTabClicks                               jquery.easytabs.js:470
jQuery.event.dispatch                                            jquery.js:3257
jQuery.event.add.elemData.handle.eventHandle                     jquery.js:2876

The second call stack is this:

jQuery.ajaxTransport.send                                        jquery.js:8103
jQuery.extend.ajax                                               jquery.js:7581
jQuery.fn.extend.load                                            jquery.js:7024
$.easytabs.activateTab                                   jquery.easytabs.js:546
$.easytabs.plugin.selectTab                              jquery.easytabs.js:217
$.easytabs.plugin.selectTabFromHashChange                jquery.easytabs.js:297
$.easytabs.initHashChange                                jquery.easytabs.js:637
jQuery.event.dispatch                                            jquery.js:3257
jQuery.event.add.elemData.handle.eventHandle                     jquery.js:2876

My js to initialize the easytabs is just

$('#maintabs').easytabs({
  panelContext: $('div#content'),
  cache: false
});

To load the html content, my backend is RoR, and each tab has a link to a controller action that renders an html file without a layout. I can post more details if necessary.

I have the haschange library also, and the back-forward behavior works fine. It reloads the tab once, as expected.

Any idea why this would happen?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions