Check if a module is enabled with JavaScript
I can think of two ways:


Send a JavaScript flag as settings, indicating the module is active:

drupal_add_js(array('my_module' =&gt; array('enabled' =&gt; TRUE)), 'setting');

If the module is enabled, modify the output in some way so the JavaScript code that makes the petition is included only when your module is enabled, or the contrary way, make sure that code is not included if your module is disabled: you will have to use another module or some kind of configuration. The exact way depends on the origin of the JavaScript code that makes the Ajax petitions.