I have created custom module called mymodule
.
In this URL localhost/mymodule/name, I have this field:
$form['name'] = array(
'#title' => t('Enter name'),
...
'#ajax' => array(
'event' => 'blur',
'callback' => 'mymodule_ajax_callback',
'wrapper' => 'my-wrapper',
'method' => 'replace',
),
...
);
My ajax callback is successfully called:
function mymodule_ajax_callback($form, &$form_state) {
...
return ...
}
However, inside 'mymodule_ajax_callback', I need to get the current URL of the page which is localhost/mymodule/name. Currently it returns system/ajax which is how Drupal works by nature.
How to get the current URL inside the ajax callback?
$form['#action']