View Full Version : changing the image onlogin

09-04-2006, 12:43 PM

iam developing a web site with online customer service feature.
1.when a customer opens my site then he should see the red button image on header(means the sales operator is not available like that)which is default.

2.when the sales operator is logged in then the red button image should change to green button image on main page(means that operator is online).

3.when second customer open our site,after sales operators login, he should see green button image(means he can chat with the operator) and similarly when sales operator logged out then the green button image should change to red one.

i have login script but when i test the condition of after login image should change,its not working.after login red button as it is.i want to do this with php/javascript...



09-06-2006, 02:43 PM
This can be done using ajax and make request every 30 seconds or something. What you need to do is:

- A php script which will return 0 (operator is available) or 1 (operator is unavailable). 0 or 1 can be whatever but the shorter the faster.
- On the main page, make request to that php script via ajax and update the image through dom.