<quote name="Merrill Oveson" date="Mon, 13 Dec 2010 at 15:47 -0700">
> What is the event that is triggered when a php file in loaded from ajax.
> 
> All I need is an event.
> 
> This works:  print "<input onclick=\"displayExpiration('y')\"
> type=\"radio\" name=\"licenseExpires\" value=\"1\"
> checked=\"checked\">";
> 
> It calls displayExpiration() which is present on the php file calling
> creating the ajax php file.

This is not how ajax works. There is no "ajax event" that gets called
automatically. What you do have is an ajax library, which makes the http
request to the server asynchronously, with which you register a callback
to get called on completion. It depends on the ajax library you are
using, but essentially you define the callback in the same place you
create the ajax call in the first place.

As for running javascript at ajax completion, you can either have the
ajax response be a snippet of javascript that immediately gets
evaluated, or you can have your callback invoke a function that is
loaded with the main page. I'm not sure if "onload" events and the like
would work with an ajax loaded piece of HTML, I kinda think they don't,
but I haven't researched it by any means. This coming from the fact that
the ajax response usually is not a full html page, but rather just a
snippet of html that gets inserted into *the* (already existing) page.

Hope that helps clear things a little.
-- 
Von Fugal

Attachment: pgpAssqjs1mRg.pgp
Description: PGP signature

/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/

Reply via email to