Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] calling js function from php


  • From: asureshkumar_1983 at yahoo.co.in (suresh kumar)
  • Subject: [Javascript] calling js function from php
  • Date: Mon May 29 11:51:54 2006

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

Steven Chipman <sgchipman@xxxxxxxxx> 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@xxxxxxxxxx
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.LaTech.edu/pipermail/javascript/attachments/20060529/2ebe7b16/attachment.html