I have a php function which ends with a refresh of the page and then throws a javascript function declared:
<script>
var u = null;
function tab(u) {
$('#element1').css('display', 'block');
$('#element2').css('display', 'none');
}
</script>
<?php
if (isset($_POST['submit1'])) {
$tab = 1;
header("Refresh:0");
echo "<script>window.scrollTo(0, 1000);</script>";
echo "<script>tab(".$tab.");</script>";
}
?>
The function of window.scrollto works, but the tab function not. I wrote ob_start and ob_end_flush to avoid headers problems.