com_ajax
Add functional ajax in admin module
replace
$helperFile = JPATH_BASE . '/modules/mod_' . $module . '/helper.php';
to
$basePath = ($table->client_id) ? JPATH_ADMINISTRATOR : JPATH_SITE; $helperFile = $basePath . '/modules/mod_' . $module . '/helper.php';
remove
// Load language file for module $basePath = JPATH_BASE;
No
Labels |
Added:
?
|
I do not think it is an issue, you just have to do a correct request:
for site modules: /index.php?option=com_ajax&module=foobar&format=json
for admin modules: /administrator/index.php?option=com_ajax&module=foobar&format=json
Same as with any component.
This is no good if you want to use Ajax in module form.
why you ever need that? :)
It the same as for components, you cannot execute Site component by doing request to Backend, and vice versa. The same applies to the modules.
To update form fields using AJAX. It's a reasonable use case.
Ah okay, I finally get it, it for a module configuration form, not for a module itself
Well, then, just add &client=0
to query, and update com_ajax to use it.
So you can call site module from backend. Eg:
/administrator/index.php?option=com_ajax&module=foobar&format=json&client=0
But, it should be forbidden to call administrator module from the site. So if someone call &client=1
from the site then com_ajax should throw an error.
Labels |
Added:
?
No Code Attached Yet
Removed: ? |
JPATH_BASE
already holds a correct path, for an administrator and for a site.If you need access to administrator module then do request to
/administrator
.