Welcome to the site!
Not really sure if you understand PHP and AJAX and Javascript/JQuery⌠I will give you some info on these.
PHP is SERVER-SIDE ONLY. Very important to know. You will never see any PHP code in a webpage except to display code as you did above. It is NOT executable in a browser. AJax is a two part process, the Javascript or JQuery call which are all CLIENT-SIDE and the PHP file called which is server-side.
Therefore, if you use Javascript/JQuery in the client to call a process as you showed in the Cursos section, it must go to a JS/JQ routine, which can call or recall the routing.php file. But, you would need to pass the new name to the AJax so it can pass it to the PHP so the result can come back. But, this causes issues with redisplaying the data. Since you have set it up in PHP with three sections, header, view, footer, it would probably be more efficient to just use standard posting and have the button refresh the page with the correct view. It would be better that. If you have a very complicated page and need to just refresh one section with the new page, you can do that. Perhaps you should tell us why you are going thru all these back and forth between server and client.
You could just load the second file into a DIV. It would just take a simple JQuery script. Here is a sample from a site I just found: This first part just shows a link without a HREF so it is handled by the JQuery code and contains a DIV with your original code.
< a id=âcursosâ>Cursos< /a>
< div id=âmainâ>This is original stuff you want displayed< /div>
Next you would have the other file to include this layout to allow you to replace it into the first:
< div id=âmainâ>Different stuff to replace into the first display< /div>
And a small JQuery script:
< script type=âtext/javascriptâ language=âjavascriptâ>
$(document).ready(function() {
$(â#cursosâ).click(function(){
$(â#mainâ).load(âviews/view-name.php #mainâ, function() {
});
});
});
You could just alter the data loaded into the DIV so that it places the correct name in the link for the file-name that needs to be loaded. If you have many different buttons, you could just use a simple drop-down to list them and have the drop-down trigger a refresh of the page with the correct view in place.
Not sure if this all will confuse you or help. Hope it helps! If not, give us a better description of what you are attempting to do. Good luck!