I am using this code to call a javascript function and then redirect PHP page.
<script type='text/javascript'>
mixpanel.track('login: Login ', {'page name' : document.title, 'url' : window.location.pathname});
</script>;
<?php
header("Location:".$domain_name."/services.htm");
?>
But this code is not working, if i don't redirect then js function works fine.
i also tried ob_start();
and ob_end_flush();
but nothing worked. How can use JS function before redirect. i am new to JavaScript and PHP header function.