Including a JS file into a PHP file and passing values back
Posted: Thu Oct 25, 2007 11:34 am
Hi.
I have a PHP page which uses Ajax to fetch MySQL database results. The Ajax function is included in the head as a .js file and the PHP code to query the database is included in the head, also as a Javascript file, but the extension is .PHP
But I want to be able to pass a GET variable from the PHP that is loaded in the browser back to the search_suggestions.php page so the database querying can be more dynamic.
How could this be done? I've played about but the search_suggestions.php page doesn't read the GET variables from the page loaded by the browser.
I have a PHP page which uses Ajax to fetch MySQL database results. The Ajax function is included in the head as a .js file and the PHP code to query the database is included in the head, also as a Javascript file, but the extension is .PHP
Code: Select all
<script language="javascript" type="text/javascript" src="./js/search_suggestions.php"></script>How could this be done? I've played about but the search_suggestions.php page doesn't read the GET variables from the page loaded by the browser.