Susan Shemin wrote:
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.
Please be gentle with me -- but what am I missing and is it at all
possible, Ajax or not?
Sure. Here's an excerpt of something similar using xAjax in a project
I'm working on now:
/* HTML */
<a href="javascript:void(null)"
onclick="this.blur();
div_off('id_add_note_off');
xajax_load_contact_notes_server('id_view_note',
'id_view_note_on', {$notes[i].contact_note_id});
return false;">
<img src="/images/icons/edit.gif" border="0" alt="edit"></a>
/* PHP */
function load_contact_notes_server($container_id, $div_id, $contact_note_id)
{
global $trms;
$ajax_response = new xajaxResponse();
// Load vendor
list($results, $message) = admin_get_contact_notes($trms,
$contact_note_id, true);
// ....
$ajax_response->assign($container_id, 'innerHTML',
$trms->fetch('view_contact_note.tpl'));
$ajax_response->call('div_on', $div_id);
return $ajax_response;
}
_______________________________________________
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