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
-
One way I can think of is using WebSockets.JCOC611– JCOC6112015-01-15 17:33:12 +00:00Commented Jan 15, 2015 at 17:33
-
Simple AJAX calls will likely solve your problem. If you need to go cross-domain, use CORS.Brad– Brad2015-01-15 17:34:40 +00:00Commented Jan 15, 2015 at 17:34
-
Hi,thank you for fast reply. I'm not very skilled could you please give me an example of that?robolo– robolo2015-01-15 17:50:03 +00:00Commented Jan 15, 2015 at 17:50
Add a comment
|
2 Answers
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
Comments
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.