Page 1 of 1

php instant update w/o reloading page

Posted: Sat Sep 29, 2007 2:18 pm
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

Posted: Sat Sep 29, 2007 3:48 pm
by superdezign
Look into AJAX. Facebook uses it extensively.

Posted: Sat Sep 29, 2007 3:55 pm
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?

Posted: Sat Sep 29, 2007 4:01 pm
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.

Posted: Sat Sep 29, 2007 10:00 pm
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!