NYCPHP Meetup

NYPHP.org

[nycphp-talk] javascript calling php function -- now question on Ajax

Ken Robinson kenrbnsn at rbnsn.com
Mon Feb 18 23:31:14 EST 2008


At 11:20 PM 2/18/2008, Susan Shemin wrote:
>My quick fix didn't work because it put entries into the database as 
>the page loaded -- but they were there...
>
>Anyway, Ajax is usually used to open an external file into a div, 
>and it uses a form to send the request.  What I want to do is 
>trigger a php script to run when someone clicks a certain anchor 
>URL.  I guess you would call it my own stats attempt.  So I have no 
>form, and nothing to be displayed on the current page because the 
>user is going to URL from the click.

AJAX is just the technique to use for Javascript to invoke a PHP 
script. It has nothing to do with loading anything, that is up to 
your logic.  I use the Yahoo User Interface libraries when I want to 
do AJAX (just my preference). There are many places where I send a 
POST string to my script with information and I don't care what is returned.

Just set up an "OnClick" Javascript function which does the AJAX POST 
to your php script and then continues to where ever you want.

Ken


>
>Please be gentle with me -- but what am I missing and is it at all 
>possible, Ajax or not?
>
>Susan
>
>----- Original Message ----
>From: Susan Shemin <susan_shemin at yahoo.com>
>To: NYPHP Talk <talk at lists.nyphp.org>
>Sent: Monday, February 18, 2008 1:33:17 PM
>Subject: Re: [nycphp-talk] javascript calling php function
>
>I so wanted to avoid using Ajax only because my webpages are simple 
>ones.  I've implemented Ajax on another website, and I'll just bring 
>it over here.  Or, I'll might stay with the "you have an error" 
>message in the status line, because the function is working -- the 
>data from the called function does go into my database.  My users 
>are mostly low tech, and they probably wouldn't notice the error, 
>but I know how I react when I see "Done, with errors" at a major website!
>
>Thanks for the responses.
>
>Susan
>
>
>-----Inline Attachment Follows-----
>
>_______________________________________________
>New York PHP Community Talk Mailing List
>http://lists.nyphp.org/mailman/listinfo/talk
>
>NYPHPCon 2006 Presentations Online
>http://www.nyphpcon.com
>
>Show Your Participation in New York PHP
>http://www.nyphp.org/show_participation.php
>
>_______________________________________________
>New York PHP Community Talk Mailing List
>http://lists.nyphp.org/mailman/listinfo/talk
>
>NYPHPCon 2006 Presentations Online
>http://www.nyphpcon.com
>
>Show Your Participation in New York PHP
>http://www.nyphp.org/show_participation.php




More information about the talk mailing list