Reputation: 552
I have a webpage, where you can comment on. What I want is whenever somebody enters a comment, this comment should be appear in all users window.
There is a Jquery code that handle inserting comment to database without refreshing it. However for new comments, I am calling a php file with ajax to control whether there is a new comment or not. I need to control this php file "continuous time" however, all I can do is refreshing it with timeinterval() method.
Is there any way to invoke javascript through input of another user?
Sorry for my English..
Upvotes: 1
Views: 547
Reputation: 63734
As JohnP and Thorben said: It is possible to use a long lasting request. This technique is called comet and you can read the basics here: comet programming. If you want example, search for Ajax chat, good luck.
Upvotes: 0
Reputation: 6981
Nope there is not. You can only pull data from a server, no push possible. There are workarounds possible where a JS connection to the server is just kept open thus making it possible to send and receive data without a new request (I think Google Wave used it). But those workarounds probably need changes on the server side. Whats wrong with a timer?
Upvotes: 0