Jump to content

Check Out This(tying to do by ajax)


anushka

Recommended Posts

I am mataining the finance company,where i give guides to the the Shares holders,when to sell and when to buy.i cant keep on calling them.I have the records Of all my customer And all are regisetered under different

Website like hotmail,gmail. when i send message it should go to all customers like message not a mail.i am thinking to give a pop up window .Like You got a new Message.suppose if they are not loginin at that time i send the message .then i am thinking to display the message when he login

Is it possible to do

Please tell me how to proceed..I m confident that we can do

Link to comment
https://forums.phpfreaks.com/topic/98118-check-out-thistying-to-do-by-ajax/
Share on other sites

Well you have to use 1 solution, however 2 implementations 1 contains AJAX the other can be done without.

Example adding

 

window.document.setInterval('ajaxFunction()',120000); 

 

will execute the ajax command on a loop every 2 mintues. Now what you would have to do is create a php command that allowed for you check to see if the message has been viewed by the logged in user. Ill leave that part up to you as this is a backend script unique to your programming style.

 

NOWEVER YOU MUST HAVE A JAVASCRIPT FUNCTION AT THE BOTTOM OF THE SCRIPT IF THERE ARE MESSAGES UNREAD. TO SHOW THE DIV. SIMPLY USE A ABSOLUTE DIV PLACED AT THE CENTER OF THE PAGE AND ABOUT 100PX FROM THE TOP.

 

EXAMPLE:

<div id="VirtualMessage" style="position: absolute; top: 100px; left: 50%; margin-left: {ENTER 1/2 OF DIV LENGTH HERE}px; display:none;" ></div>

 

Your ajax command calling the backend file will populate the information within the div of course.

 

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

 

Since it you have the interval auto running it will automatically start checking on login. What I would do is add a timeout so that you instantly check because the 1st check wont start for 2 minutes. so enter this at the bottom of the first screen they see once logged in.

 

window.document.setTimeout('ajaxFunction()',0); 

 

That should do it.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.