Hi,
How would I go about setting up a URL “listener”/”hook” so that I can make AJAX calls to my extension?
Can’t find anything on this anywhere! I could of course directly call the extension script, but that would mean removing
if ( ! defined('EXT')) {
exit('Invalid file request'); }
from the top of my extension.
Would this be the “correct” way to go about this? Or is there a way to hook an extension method to a URI?
Any advice much appreciated.
Thanks Victor,
OK. I’ve gone for the Action Id option as my extension is purely back-end, I wonder if you could help me further?
I am writing an extension to add a custom field type to the publish form (similar in function to Playa extension, but instead to assign Roles to People).
I have defined my action_id with the following code:
$DB->query(
$DB->insert_string('exp_actions',
array('action_id' => '',
'class' => get_class($this),
'method' => 'ajax_refresh'
)
)
);
and obtained the “action_id” with the following:
$action_id = $FNS->fetch_action_id(get_class($this), 'ajax_refresh');
Which returns a template variable:
{AID:Vc_people_roles:ajax_refresh}
As I’m working within an extension, using hooks to modify the publish page I’m obviously not using templates
How would I go about “parsing” or “returning the value” for the action_id ?
Any advice much appreciated!
Thanks
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.