ToolJob Posted May 12, 2011 Share Posted May 12, 2011 I have a MySQL query that pulls records from my database and displays them. I want to start using AJAX inside my scripts to make my websites more professional. Does anyone know of any example scripts that will pull some data and have like a Sort link a user can click on to sort the SQL query by price (min/max)using AJAX? I have Larry's book "Bulding a Web Site with AJAX, but the examples use dropdown menus not hyperlinks to sort the SQL results. Thanks in advance for any information. ToolJob Link to comment Share on other sites More sharing options...
Jonathon Posted May 12, 2011 Share Posted May 12, 2011 I would think you could change it to "onClick", so when you click the hyperlink you call the new ajax request. 1 Link to comment Share on other sites More sharing options...
HartleySan Posted May 13, 2011 Share Posted May 13, 2011 ToolJob, you can use any sort of JavaScript event to trigger an Ajax request to a PHP script to get information. Be aware that if you, for example, attach an onclick event to an a tag, you need to return false, in order to squelch the default behavior of the browser wanting to follow the href in the a tag. Sorry for the brief response, but in a bit of a hurry. If you want more specific information, just ask. 1 Link to comment Share on other sites More sharing options...
Recommended Posts