Ajax call to module helper function

50 views
Skip to first unread message

Pgs Ss

unread,
Mar 21, 2017, 11:06:00 AM3/21/17
to Joomla! General Development
I 've made a custom module, com_menubrand.
I want to make an Ajax (I use com_ajax) call to a php function in the module 's helper file.
I 've done it like this:

$.ajax({
type: "POST",
url: "index.php?option=com_ajax&module=menubrand& method=recreateMenuItemsB()&format=json",
success: function (result) {
console.log(result);
}


The function in my helper file:
public static function recreateMenuItemsBAjax() {
$return_data = "aaaa";
echo (json_encode($return_data));
}

But I get an error:
"Module mod_menubrand is not published, you do not have access to it, or it's not assigned to the current menu item."

And success = false.

How can I make it work?

Dmitry Rekun aka b2z

unread,
Mar 24, 2017, 8:18:04 AM3/24/17
to Joomla! General Development
Hello!

Is it admin module? If so it won't work.

Dmitry

Pgs Ss

unread,
Mar 26, 2017, 10:35:39 AM3/26/17
to Joomla! General Development
Yes it is an admin module.
Reply all
Reply to author
Forward
0 new messages