title: AJAX call to invoke a remote JS function
body: <p>I have a slideshow (jQuery Cycle2 plugin) running on a server. The slideshow can be paused and stopped with buttons invoking jQuery functions on the slideshow.</p>
  
  <p>The application is structured as follows: In the index.php I define the slideshow functions (stop, pause, etc.) and an AJAX call within a function that sends a POST to another PHP script to load the slideshow content from the server. So far, this works nicely.</p>
  
  <p>Now, I want to have another script (or maybe Webservice) remoteControl.php that allows me to remote control my slideshow from a third device. So say I run the slideshow on the server and from another site (probably same domain) I call the slideshow functions in the index.php using also AJAX.
  At the moment this does not work. 
  In the body section of my index.php I put:</p>
  
  <pre><code>if(isset($_POST['action'])){
      $actionOnSlideshow = $_POST['action'];
      echo '&lt;script&gt;'.$actionOnSlideshow.'();&lt;/script&gt;';
  }
  ?&gt;
  </code></pre>
  
  <p>followed by all the other content and scripts for the slideshow.
  The <code>$actionOnSlideshow</code> variable contains the respective function sent from the AJAX request in the remoteControl.php.
  Could this relate to the same-origin-policy. The second AJAX call however is from the same domain so this should not be the issue!?</p>