php instant update w/o reloading page

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
suthie
Forum Commoner
Posts: 68
Joined: Sat Jun 09, 2007 10:46 am

php instant update w/o reloading page

Post by suthie »

So I have a blog thing where posts are private by default... I want users to be able to scroll through their entries and just click a button for it to instantly become puclic and update on the page. How can I make this happen without going to a different page or relading? (facebook does this all the time if you need an example. the notifications and invitations on there can be deleted without leaving the page)

Ideally, you would click this button:

Image

and it would toggle to this button:

Image

each post is in a mySQL table that has a column for a variable "shared" that is either true or false
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

Look into AJAX. Facebook uses it extensively.
suthie
Forum Commoner
Posts: 68
Joined: Sat Jun 09, 2007 10:46 am

Post by suthie »

My host does not support AJAX, and I do not have the money to upgrade at the moment. Is there a way to do this or something close to this with php?
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

... AJAX is (technically) a client-side technology. It is based in JavaScript which is controlled by the user's browser, *not* your host.

Again, look into it and it should make a bit more sense as to how it's done. There are tutorials everywhere.
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Post by califdon »

suthie wrote:My host does not support AJAX, and I do not have the money to upgrade at the moment. Is there a way to do this or something close to this with php?
Ajax is neither a language nor a library. It is simply using one particular built-in object in Javascript and handling the data returned by (for example) a PHP script on the server. If you already know Javascript, it's pretty easy. And there's nothing to support or install!
Post Reply