views:

18

answers:

0

jQuery UI tabs, access required to loaded data over ajax on tabsload event

I am using jQuery UI tabs to load content over AJAX.

JSON structure of content

{
    content: 'content-data',
    stats: 100
}

The tabs are being loaded by defining

$('#tabs-ui').tabs({
    ajaxOptions: function(result){
        var data = Drupal.parseJson(result);
        return data.content;
    }
})

Now going to respond on tabsload event of UI tabs

$('#tabs-ui').bind('tabsload', function(event, tab){
    // Here I need to access `stats` part of json content fetched over AJAX.
});

Can I store data.stats in accordance with tab list item using jQuery.data() function against ajaxOptions, and then to retrieve it on tabsload?

OR

Can I directly decode data in tabsload OR access it atleast for data.stats?