[Javascript] calling js function from php

João Cândido de Souza Neto joao at curitibaonline.com.br
Mon May 29 11:28:49 CDT 2006


Unfortunatly you can´t do this.

PHP is a server-side script and javascript is a client-side, because it, one can´t run another.

  ----- Original Message ----- 
  From: suresh kumar 
  To: javascript at LaTech.edu 
  Sent: Monday, May 29, 2006 12:38 PM
  Subject: [Javascript] calling js function from php


  i am facing  some problems in my project.

  1) i want to call a javascript function from php. this is my code.
  <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){
           return 1;
         }
         else if(con==false){
          return 0;
          
         }
        
  }
  </script>



  <?
  $res=confirmask();
          if($res==1){
          
                  $deletelocationresult=mysql_query(" update users set Status='0' where SponsorID='$editlocationid'");
                  if(mysql_affected_rows($deletelocationresult)):
                          print "<script type=\"text/javascript\">
                       alert(\"mirrored display location is deleted successfully\");
                    location.replace(\"displaylocationprofile.php\");
                    </script>";
                          exit();
                   endif;
          }
          else {
                       print "<script type=\"text/javascript\">
                       
                    location.replace(\"displaylocationprofile.php\");
                    </script>";
                          exit();
          } ?>


  2)   how can i assign a  javascript variable to php 



------------------------------------------------------------------------------
  How should a woman equip herself to travel safe even when she's unescorted? Share your knowledge with real people on Yahoo! India Answers
  Send free SMS to your Friends on Mobile from your Yahoo! Messenger Download now


------------------------------------------------------------------------------


  _______________________________________________
  Javascript mailing list
  Javascript at LaTech.edu
  https://lists.LaTech.edu/mailman/listinfo/javascript
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20060529/884eb7b3/attachment.htm>


More information about the Javascript mailing list