Prevent a javascript/php function to execute on load page -


i got php code redirect page inside 1 php function:

   <script>    function a(){       <?php          header('location: http://www.localhost.com/');       ?>      }    </script> 

i know if there way stop redirect inmediatly when load page, , if possible javascript or jquery, cause tried js , couldn't find way .

the php end of process before javascript does. i'm not sure why have set way need come different way of doing things. perhaps not using php @ best option here , using javascript command change page instead.

such as:

<script>    function a(){       window.location = "http://www.localhost.com/";     } </script>   <button onclick="a()">go</button> 

Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -