.js extension for javascript file is missing I am using below code in my custom module "my_module".

    function my_module_theme(){
        return array(
                'my_module_javascript'=&gt;array('arguments'=&gt;array(),),
        );
 }

 function my_module_init(){
        theme('my_module_javascript');
 }

 function theme_my_module_javascript(){
        drupal_add_js(drupal_get_path('module','my_module').'/my_module.js');
 }


After I enable the module page source is showing the javascript file without .js extension.
like src="modulepath/my_module?lrmjns"
Am I doing anything wrong? why is it skipping .js?
What version you are using? And are you sure the my_module.js is exist?

I think the best way is using hook_library to add js and css for your module:

function my_module_library() {
  $libraries['my-module'] = array(
    'title' =&gt; 'My custom module library',
    'version' =&gt; '1.0',
    'js' =&gt; array(
      drupal_get_path('module', 'my_module') . '/my_module.js' =&gt; array(),
    ),
  );
  return $libraries;
}

function my_module_init() {
  drupal_add_library('my_module', 'my-module');
}