I have set up an AJAX call in my module which works fine. I want to get the module parameters when I make the ajax call. So I'm doing this

$app = JFactory::getApplication();
$module = JModuleHelper::getModule('mod_moduleName_display');
$params = new JRegistry($module->params);

This works fine except I have multiple mod_moduleName_display modules instances. So it picks up the first module parameters not the one I want.

I can't find a way to get the module parameters using the module id. I could pass them into the AJAX call or get them directly from the modules table but I'm hoping that there is a standard Joomla way of doing this that I've missed.

Update showing code for AJAX call:

sermon contains the module id - i.e. sermons.moduleToUse

function runAjax(page){

    page_no = page;
    moduleToUSe =  sermons.moduleToUse;
    sermons.start = page;
    var dataJSON = sermons;

    request = {
        'option' : 'com_ajax',
        'module' :  moduleToUSe,
        'parameters'  :  sermons,
        'format' : 'json'

        type   : 'POST',
        data   : request,
        success: function (jsonObj) {

            jsonArrayResponse =  jQuery.parseJSON(jsonObj["data"]);



    return false;

  • Can you show us the Ajax call? You want to get the modules parameters, right? Jul 5, 2020 at 15:19
  • 1
    I've added the Ajax call. I pass an object with the module id which I want to use in the AJAX code to get the module params. I can do this with a database call to the modules table but I hoped Joomla had a class so that the code would be more future proofed against changes Jul 5, 2020 at 15:27
  • I have a solution but I'm not sure if this is what you need. Jul 5, 2020 at 15:28

1 Answer 1


If you know the ID, you can use JModuleHelper::getModuleById().


  • 1
    Thanks this is just what I wanted. I'd already written code to get it from the _modules table but I really wanted to use the official joomla method. Jul 5, 2020 at 15:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.