title: How to use jQuery ajax in Joomla module
body: <p>I'm creating a module where in my main PHP file I've added a reference to a Javascript file. In that Javascript file, I do a jQuery call on dom ready that does an Ajax post to grab the initial content for a div. The URL that it posts to is another PHP file (gateway.php) that is part of my module. (This gateway.php does a call to a remote server to get the content.) </p>
  
  <p>Well, direct access is typically prohibited for module files. I can comment out the line of code that prohibits direct access. Even doing that, for some reason it seems like my gateway.php doesn't have full access to everything in Joomla. For example, gateway.php has a require of my helper.php file. I'm just doing</p>
  
  <pre><code>require_once(dirname(__FILE__) . DS . 'helper.php');
  </code></pre>
  
  <p>which as far as I can tell is the standard way to include a file. However, I get errors showing that DS isn't getting translated as the value defined within Joomla. Its treating DS like a string value.</p>
  
  <p>If I change it to </p>
  
  <pre><code>require_once(dirname(__FILE__) . '/helper.php');
  </code></pre>
  
  <p>then I get the direct access prohibited error.</p>
  
  <p>Any idea what's going on here or the correct way to using Ajax in a Joomla module in a file other than the main PHP module file?</p>