There is no such thing as a jQuery variable, they are all regular Javascript variables.
The reason you cannot access the current_location variable from your function is because the variable is declared locally inside another function.
Just declare the variable outside the functions so that it is global, and you can access it from both functions:
var current_location; $(function() { ....... ....... ....... var api = pane.data('jsp'); current_location = api.getContentPositionX(); } function change_title(t_index) { alert("print=" + current_location); window.location.href = "page.php?p=" + current_location; }
source share