0

I have a html page on a web server (it's a remote outlet programmable via LAN) with a js script included. I need to execute a function declared on this .js from a remote server php's page. I cannot understand how to do and if it's possible. thank you roberto

robolo
  • 1
  • 1
  • One way I can think of is using [WebSockets](https://developer.mozilla.org/en/docs/WebSockets). – JCOC611 Jan 15 '15 at 17:33
  • Simple AJAX calls will likely solve your problem. If you need to go cross-domain, use CORS. – Brad Jan 15 '15 at 17:34
  • Hi,thank you for fast reply. I'm not very skilled could you please give me an example of that? – robolo Jan 15 '15 at 17:50

2 Answers2

1

I believe it is not allowed because of the security issue. You can see what is possible here: http://jquery-howto.blogspot.com/2013/09/jquery-cross-domain-ajax-request.html

MaxZoom
  • 7,619
  • 5
  • 28
  • 44
0

You can use an iFrame.

When your user opens the php page, it will contain an iframe that opens the html page of the other web server.

Here's a stackoverflow question that answers how to do that Invoking JavaScript code in an iframe from the parent page

if you don't want the iframe to be visible you can hide with CSS.

Community
  • 1
  • 1
TchiYuan
  • 4,258
  • 5
  • 28
  • 35