![]() |
Updating list without page refresh
Hi, using Gareths tutorial (TalkPHP - Simple AJAX with JQuery) I made a script which adds items to a database without having to refresh the page.
Now I want to display the list of the items above the form (which I have managed to do) but I want it to automatically update with the new items, could anybody show me how I would do this? I would also like to be able to delete and edit the items without having to refresh the page if possible. |
Here's what I have so far:
Code:
<?php |
You will have to think about this in the following way:
You have 2 DIV:s One for containing the list you wish to edit and the other one the form that adds and edits. And when you add something to the list via a submit in the form, have the JavaScript update the DIV with the list. For the easy approach have a file called for example ajax_list.php that gets loaded into the list DIV each time something needs to be updated. In that way if you add something new with the form the DIV with the list updates and reflects the changes. And for the ease of editing have a file called for example ajax_edit.php containing the form code as well the PHP code for adding and saving, as well as for retrieving the data thats been selected in the list DIV and load it into the form. Think of the to DIV:s as "iframes" that you load ordinary PHP files into with the help of JavaScript and AJAX. Hope this wasn´t to confusing. :D Good luck. /Eye |
Thanks for the reply.
I've pretty much got everything I wanted to do done apart from the edit in place. Because the list page is included (so it can be reloaded without refreshing the page) the edit in place thing wont work. Does anybody know how to get round this? You can see what I have got done here: List |
| All times are GMT. The time now is 08:09 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0