php website and Jquery $.ajax() <p>The website I'm developing is structured in this way:</p> <p>It has a function that switches the module for the homepage content when <code>$_GET['module']</code> is set, example:</p> <pre><code>function switchmodules() { $module=$_GET['module']; switch($module) { case 'getnews': news(); break; default: def(); } } </code></pre> <p>As you can see, this switch calls another function for each module.</p> <p>For example I wrote <code>getNews()</code> to work in this way:</p> <pre><code>function getNews() { $id=$_GET['id']; if(!id) { //CODE TO LIST ALL NEWS } if(isset($id)) { //CODE TO GET ONLY 1 NEWS BY ID } } </code></pre> <p>So, as you can see I'm not using an unique file for each module; all operations of a module are part of an unique function in which an action is switched again to change the result.</p> <p>If I want to get a news from database I should use an url like this: <code>?index.php&amp;module=getnews&amp;id=1</code></p> <p>My question now is:<br> With jQuery and <code>$.ajax()</code> method is there a way to get a news (for example) using this structure based on functions switched by a get? Or do I have to change everything and make a file for each function?</p>