To create thumbnails & cache files, I have to access my already created Ajax Functions inside my helper.php file.
I'm already able to call the functions within the frontend (button that is visible when debug is active calls the js functions) -- all fine from frontend -- but if I add the same js into the backend I get the error:
The file at mod_modname/helper.php does not exist.
My request looks like this:
let data = {
'moduleId': '{$moduleId}'
};
let request = {
'url' : '{$url}', // is JURI::current() //--> already tried without
'option': 'com_ajax',
'module': 'modname',
'method': 'getImages',
'data': str_data,
'format': 'json'
};
so JURI::current
here is: mydomain.tld/administrator/index.php
The initial call that did not work is located in 'mod_mymodname/models/fields/myCustomfield.php' as follows:
protected function getInput()
{
$formData = json_decode($this->form->getData('jform'),'true');
if(isset($formData['id'])) {
$moduleId = $formData['id'];
include JPATH_ROOT.'/modules/mod_modname/helper/buildCache.js.php';
$doc = JFactory::getDocument();
$doc->addScriptDeclaration($buildCacheActivation);
...
Keep in mind - all works from frontend, just from module backend (where I also want to be able to "create" the cache, I receive that error).
I think it could be something with the path / the different locations from where the script will be called?
Unfortunately, I did not find any solution for this issue in the guides.
Edit: Added Ajax Call URL Frontend:
url=http%3A%2F%2Flocalhost%2Fjoomla1%2Findex.php&option=com_ajax&module=modulename&method=getGalleries&data=%7B%22moduleId%22%3A%22110%22%7D&format=json
Backend:
url=http%3A%2F%2Flocalhost%2Fjoomla1%2Findex.php&option=com_ajax&module=modulename&method=getGalleries&data=%7B%22moduleId%22%3A%22110%22%7D&format=json
So its the same....
different are the "Request URL" which is as follows from backend: http://localhost/joomla1/administrator/index.php?option=com_modules&view=module&layout=edit&id=110