NYCPHP Meetup

NYPHP.org

[nycphp-talk] javascript calling php function

tedd tedd at sperling.com
Mon Feb 18 14:46:20 EST 2008


At 2:23 AM -0800 2/18/08, Susan Shemin wrote:
>I want to use javascript onclick to call a php function.  This code 
>works, but puts a "done, with errors" in the status line in the file 
>when loaded, which I do not want.  (I've done some error testing and 
>isolation, and found the onclick is what is causing the "errors" 
>message.)  Any ideas -- or other ways to do it?
>
>onclick="<?php here_it_is(); ?>";
>
>Also, I tried onclick=""; to make sure that it's the "embedded" php 
>code that's the culprit, thinking that maybe javascript is reading 
>the php code as nothing inside the quotes.
>
>Susan

Susan:

I need more information.

 From what you described above, you don't even need js to call a php 
script. You can do it like this:

<a href="here_it_is.php"> Click this </a>

If you want to pass a variable, then try this:

<a href="here_it_is.php?var=whatever"> Click this </a>

There's lot's of ways to communicate between php and javascript, like this --

http://webbytedd.com/b/timed-php/

-- but you need the secret handshake to do it.

So, tell us what you're trying to do and we'll provide guidance, if 
not downright confusion

Cheers,

tedd

-- 
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com



More information about the talk mailing list