javascript - AJAX call to invoke a remote JS function -


i have slideshow (jquery cycle2 plugin) running on server. slideshow can paused , stopped buttons invoking jquery functions on slideshow.

the application structured follows: in index.php define slideshow functions (stop, pause, etc.) , ajax call within function sends post php script load slideshow content server. far, works nicely.

now, want have script (or maybe webservice) remotecontrol.php allows me remote control slideshow third device. run slideshow on server , site (probably same domain) call slideshow functions in index.php using ajax. @ moment not work. in body section of index.php put:

if(isset($_post['action'])){     $actiononslideshow = $_post['action'];     echo '<script>'.$actiononslideshow.'();</script>'; } ?> 

followed other content , scripts slideshow. $actiononslideshow variable contains respective function sent ajax request in remotecontrol.php. relate same-origin-policy. second ajax call same domain should not issue!?

  1. i'm assuming don't want rebuild app using meteor js on server, pushes updates client. you'd have rebuild php pages i'm mentioning reference.

  2. websockets promising not yet stable enough cross-platform production.

  3. if running nginx , can recompile, can use nginx_http_push_module combined ajax long polling.

  4. and if else fails, ajax using old settimeout , setinterval work.


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

visual studio 2010 - Connect to informix database windows form application -

android - Associate same looper with different threads -