[nycphp-talk] javascript calling php function -- now question on Ajax
csnyder
chsnyder at gmail.com
Tue Feb 19 11:33:42 EST 2008
On Feb 18, 2008 11:58 PM, Susan Shemin <susan_shemin at yahoo.com> wrote:
>
> thanks, Mike and Ken
>
> first off, I'm not using a form (so no POST); the link is in an anchor tag.
> I could put a form around it, but that seems to me making a simple link
> complex.
>
The conceptual bit that you may be missing is that you can POST data
to a php script without using a form.
The javascript XMLHttpRequest object can make GET or POST requests in
the background, without any kind of user intervention.
The onclick event sends a background request to your script, then
sends the user on their way to the linked url. As far as I know you
don't even have to wait around for the response.
Disadvantage is that you have to learn how AJAX works. But the
advantage over a simple redirect script is that Google and others will
see your links as normal links.
--
Chris Snyder
http://chxo.com/
More information about the talk
mailing list