title: Javascript Http Get Request error : NS_ERROR_FAILURE
body: <p>I'm writting a website (it's my very first without java..) and what is done is simple.
  I call a javascript function "changeVideo()" that make a request to a php page "GetAVideo.php" which returns the url to a randomly choosen video (choosen between videos files on my server).</p>
  
  <p>Last night, i could watch videos without problem but today, when i load my page, the video is not loaded because the GET request fails :
  "NS_ERROR_FAILURE: Failure
  xhr_object.send();"</p>
  
  <p>I can't understand why, here are my sources :
  javascript:</p>
  
  <pre><code>function changeVideo() 
  {
      console.log("changeVideo path:", path);
      var xhr_object = null;
      if (window.XMLHttpRequest) // Firefox 
          xhr_object = new XMLHttpRequest();
      else if (window.ActiveXObject) // Internet Explorer 
          xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
      var request = "http://ogdabou.com/php/GetAVideo.php";
  
      console.log("request: ", request);
      xhr_object.open("GET", request, false);
      xhr_object.send();
      console.log("response: ", xhr_object.responseText);
      videoPlayer.src(xhr_object.responseText);
      videoPlayer.currentTime(0);
      videoPlayer.play();
      document.getElementById("videoTitle").innerHTML = xhr_object.responseText;
      return false;
  };
  </code></pre>
  
  <p>php :</p>
  
  <pre><code>&lt;?php
      $dirname = '../videos';
  
      $videoList = array();
  
      $dir = opendir($dirname);
      if (count($_GET) &gt; 0)
      {
          $folders=explode(";", $_GET['folders']);
          foreach ($folders as $videoFolder) {
              $fullPath = $dirname."/".$videoFolder;
              echo "Visiting $fullpath";
              $videoList = fillVideoList($fullPath, $videoList);
          }
      }
      else
      {
          $videoList = fillVideoList($dirname, $videoList);
      }
      //use join to get the paths.
  
      closedir($dir);
      $choosenOne = $videoList[rand(0, count($videoList) - 1)];
      $choosenOne = str_replace("../videos/","", $choosenOne);
      echo "http://ogdabou.com/videos/".$choosenOne;
  ?&gt;
  
  &lt;?php
      // Fill the videoList with the given folder. Also visit subdirectories.
  
      function fillVideoList($folder, $videoList)
      {
  
          $path = $folder;
          $folder = opendir($folder);
          while($file = readdir($folder)) { 
                  if($file != '.' &amp;&amp; $file != '..')
                  {
                          $fullPath = "$path/$file";
                          if (is_dir($fullPath))
                          {
                                  $videoList = fillVideoList($fullPath, $videoList);
                          }
                          else if(pathinfo($fullPath, PATHINFO_EXTENSION) == "webm")
                          {
                                  $videoList[] = $fullPath;
                          }
                  }    
          }
          return $videoList;  
      }
  ?&gt;
  </code></pre>
  
  <p>Thank you !</p>