"<?php echo url('/', 'AjaxController'); ?>"
The ajax controller offers a trigger-based framework for responding to ajax requests.
Responding to Ajax Requests
You must provide a unique route action in your ajax GET or POST request in order for your request to be routed to a responder in your module. Adding an
ajax_foobarbaz() trigger function to your module will enable your module to respond to requests sent with a POST action of
foobarbaz or sent to /ajax/?action=foobarbaz.
false the routing process will continue, and if no other responders are found, it will conclude with a 404 error.
Module authors are encouraged to use the helper function
json_response() when responding to ajax requests.
json_response() encodes a response object containing two properties:
data. Authors are encouraged to always populate the text property with a human-readable response message. The data property can contain any arbitrary JSON-encodable data.