-1

I need a simple way to call a URL to send a command to the system without processing or displaying whatever result is returned. If I use simple HTML calls then the frame the page with the button is on changes to the result returned by my lighting system and my page of buttons goes away. If I use ajax then I run into cross domain issues.

At it's simplest I would just like to have a button process an onclick() and execute a URL (e.g. http://www.mydomain.com/lightingdevice/on) in the background or some simple javascript that runs this same URL while the frame continues to display the page with the button.

idmean
  • 14,540
  • 9
  • 54
  • 83
  • It's usually customary to post some code along with a question to help us understand where you're coming. Since they are countless ways your task could be accomplished, there are countless more ways that it could be programmed incorrectly, so it's better if you help avoid tons of guessing ;-) – StephenH Feb 19 '14 at 17:02
  • Use JSONP as suggested by this example http://stackoverflow.com/questions/3506208/jquery-ajax-cross-domain – user1477388 Feb 19 '14 at 17:02
  • Please be clear what you wanted to ask – Krishna Deepak Feb 19 '14 at 17:07

1 Answers1

1

Either way you need to use AJAX if you need to do this discretely.

  • The interface is on the same domain as your application: just use AJAX properly and you're good.
  • The interface is on some another domain as your application: create an interface on the same domain as your application, using PHP for example. This will let you use AJAX. Then just let PHP handle all the rest.enter image description here
mechanicious
  • 1,576
  • 2
  • 15
  • 32
  • This is a good idea. Still use AJAX to call PHP on your own server, then use PHP to call the external resource via `file_get_contents('http://www.example.com/');` – user1477388 Feb 19 '14 at 17:16