Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] calling js function from php
- From: sgchipman at gmail.com (Steven Chipman)
- Subject: [Javascript] calling js function from php
- Date: Mon May 29 11:45:22 2006
On 5/29/06, suresh kumar <asureshkumar_1983@xxxxxxxxxxx> wrote:
> 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;
>
> }
>
> }
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
- Follow-Ups:
- [Javascript] calling js function from php
- From: suresh kumar
- [Javascript] calling js function from php
- References:
- [Javascript] calling js function from php
- From: suresh kumar
- [Javascript] calling js function from php
- Prev by Date: [Javascript] calling js function from php
- Next by Date: [Javascript] calling js function from php
- Previous by thread: [Javascript] calling js function from php
- Next by thread: [Javascript] calling js function from php
- Index(es):