gurechan Posted January 12, 2008 Share Posted January 12, 2008 I have a list on my website that is generated from a mysql database with php. The order of this list can be changed by using up and down arrows (images that I've created) and a php script that I've written. The only minus to this is that when an arrow is clicked to move a list item the page needs to re-load to call the php script. I would like to use an Ajax function to call the php script instead, but can't seem to find a good example/tutorial on the web. Can anyone help me out or point me in the right direction. Quote Link to comment Share on other sites More sharing options...
phpQuestioner Posted January 12, 2008 Share Posted January 12, 2008 start here: http://www.ajaxfreaks.com/tutorials/1/0.php Set-up your html like this: <!--Add Your Sorting Arrow/Function Here Or Where Ever; As Long As It Is Outside The "ajaxTest" DIV--> <div id="ajaxTest"> <!--Database Results Here--> </div> <a href="javascript:void(0)" onclick="sendRequest('asc')">Sort Ascending</a> You will need to create a php page that displays just the results from your database that you want updated. Plus the html formating; so the updated data will display as you wish it display within the page (ie. table, div, td, tr). In the tutorial that I linked above; they named this php page "myphpscript.php". You can also add more then one variable to your AJAX query string; if you need to know how to do this, let me know and I will post an example of how to do that. Quote Link to comment Share on other sites More sharing options...
gurechan Posted January 14, 2008 Author Share Posted January 14, 2008 OK, thank. I'll check it out. Quote Link to comment Share on other sites More sharing options...
eZe616 Posted January 23, 2008 Share Posted January 23, 2008 phpriot has a tutorial on how to build a sortable list Here, maybe it's more to your liking... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.