Javascript – Jquery tab reload with a parameter

javascriptjqueryjquery-ui

After some events in a tab, I would like to reload it. I need to send a parameter to the page that loads into the tab.

The following reloads the page: $("#tabs").tabs( 'load' , 6);

But, how can I send a parameter with it?

Best Answer

// Read a page's GET URL variables and return them as an associative array.
function getUrlVars()
{
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');

    for(var i = 0; i < hashes.length; i++)
    {
        hash = hashes[i].split('=');
        vars.push(hash[0]);
        vars[hash[0]] = hash[1];
    }

    return vars;
}

Then you can grab the url variables and adjust your tab accordingly (i just did this on a project no more than an hour ago!!)

Code taken from snipplr.com