[Javascript] calling js function from php

suresh kumar asureshkumar_1983 at yahoo.co.in
Mon May 29 11:51:47 CDT 2006


Sorry,i cant able to understand ur logic.plz explain with some more details that will hepfull for my project

Steven Chipman <sgchipman at gmail.com> wrote:  On 5/29/06, suresh kumar wrote:

> 1) i want to call a javascript function from php. this is my code.
>  
>  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;
>
>        }
>
> }

The confirm method returns boolean, so you dont need to check its
state for true and then return true if it is. This will suffice:

return confirm("you are trying to cancel a mirrored display
location.Do u want to continue");

>
> > $res=confirmask();
...snip
> 2)   how can i assign a  javascript variable to php

Why not just submit a form to a PHP script that does your database
action and then does your location.replace? For example:

document.forms[0].onsubmit = return confirm("are you sure?");

When a user activates the link or whatever you are using to call the
delete action, you can populate the form with the required ids, etc,
and then call the submit method of the form.


-- 
steve
http://slayeroffice.com
_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript

   
				
---------------------------------
  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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20060529/2ebe7b16/attachment.htm>


More information about the Javascript mailing list