I have a set of jQuery Ajax tabs which need to be opened using a dynamic parameter, defined in a global Javascript variable.
So far I have this:
function getVariable() {
return globalVar;
}
$(document).ready(function(){
$("#tabs").tabs({
ajaxOptions: {
data: {dynamicParameter: getVariable()}
}
});
});
<div id="tabs">
<ul>
<li><a href="firstTab.html" title="first">First</a></li>
<li><a href="secondTab.html" title="second">Second</a></li>
</ul>
</div>
When I click on each of the tabs, request is generated as "firstTab.html?dynamicParameter=someValue".
The problem is, as globalVar value changes, my requests do not, they remain exactly the same as with initial load. Is there a way I can get them to reflect the changes from my variable?