Page 1 of 1

How to code a server-initiated notification window

Posted: Fri Jun 27, 2008 9:57 am
by cormanaz
Hello all. I am trying to figure out how I can get php to create a notification window. Specifically, I have news items listed on a page and I want users to be able to click a link that is part of the item to flag it for others (i.e. sort of a social bookmarking function). When such a link is clicked, I will need to either notify them that their action has succeeded or that they have already flagged the item. I would like this to happen with a popup or similar control, as I don't want to navigate users away from the page.

I know I could use php to insert javascript to do popups, but that is client side. The checking for success or an existing flag will need to operate on the server side, so the server will have to open the window. Is there some way to use php to accomplish what I'm describing here?

TIA

Steve

Re: How to code a server-initiated notification window

Posted: Fri Jun 27, 2008 10:15 am
by nowaydown1
Greetings Steve,

Welcome to the forum. At some point down the line, you will have to fall back on javascript to get your popup window thing going. If you want to have your success / existing flag check done by the server, you could use AJAX to send a request to your PHP backend, have javascript parse the result, and open a popup window accordingly. So in that circumstance, your server side will make the open / don't open decision, and the client side is responsible for dealing with how to open the window or notify the user, etc.

If you haven't worked with AJAX before, there's tons of stuff about it online. Just google around a bit.