单击第一个网站上的按钮,在第二个网站上运行jQuery

I have one scenario that in first website I have a link and second website have some jQuery alert.

What I want is that by clicking the link in first website alert will show in second website without reloading any page. Both websites are open in different machines.

Language of websites: PHP

You have 2 options:

  1. Long-polling: Basically, whenever your button is clicked, you change something in the server, e.g you change a column in your database. And all the while, in your second page (the one you want to make the alert), you have a long-lived connection to another server-side file that constantly checks the value of that column in the database, and whenever you detect a change (which reflects the click), you return something to your JQuery (I implemented that using a while loop and the sleep function in PHP.

  2. Websockets, in PHP, this means Ratchet.

For your case, I recommend the first approach, much simpler and easier to implement. I would use websockets for something like instant-messaging.