what way should I structure my files when doing Jquery AJAX requests in PHP.
i.e.
- showRecords.htm – contains jQuery/AJAX that gets data (HTML) from the php file below.
- showRecords.php – contains php that does some processing, likely to get data from DB and echo some HTML.
or
one file:
- showRecords.php – contains the JQuery/AJAX and is the php file and requests data from itself.
also you clever people out there, please note I am a beginner in JQuery
and AJAX so please forgive me if its a silly question or trivial.
Obviously not: one file.
I’d do it this way:
And if the jQuery/Ajax modifies the HTML, you could also move that (the dynamic HTML) into the templates (read about javascript templates)