[Javascript] calling js function from php

joel.goldstick at columbuswebmakers.com joel.goldstick at columbuswebmakers.com
Mon May 29 11:36:40 CDT 2006



suresh kumar wrote:
> i am facing  some problems in my project.
>    
>   1) i want to call a javascript function from php. this is my code.

First, understand that your php code runs when the reader requests the 
webpage.  It runs on the host site -- before the reader receives the 
page.  What the reader sees is the resulting html and javascript.

The javascript runs in the browser.  You can run javascript code which 
then requests a new page from the host.  In your example, you might want 
to request a new page with the URL : yourpage.php?con=1 or 
yourpage.php?con=0


>   <script type="text/javascript">
>    function confirmask()
> {         
>          
>        var con=confirm("you are trying to cancel a mirrored display location.Do u want to continue");
>        if(con==true){
>          window.location("yourpage.php?con=1");  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>        }
>        else if(con==false){
>          window.location("yourpage.php?con=0");>  <<<<<<<<<<<<<<<<<<<<<<<<<<<
>        }
>       
>   }
>   </script>

-- 
Joel Goldstick
www.columbuswebmakers.com



More information about the Javascript mailing list