title: Embed Facebook video via ajax
body: <p>I have a Database where I store the ID of X videos from Facebook also, Youtube and vimeo, then I load any video via Ajax, vimeo and Youtube load perfectly but Facebook doesn't load, it only loads the html but the code that I get via ajax also contains a script wich is requiered by Facebook...<br>
  To embed a video from Facebook the code is this:<br></p>
  
  <pre><code>&lt;script&gt;
      (function(d, s, id)
      {  var js, fjs = d.getElementsByTagName(s)[0];
          if (d.getElementById(id)) return;
          js = d.createElement(s);
          js.id = id;
          js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&amp;version=v2.0";
          fjs.parentNode.insertBefore(js, fjs);
      }(document, 'script', 'facebook-jssdk')
          );
  &lt;/script&gt;
  &lt;div class="hidden-xs hidden-sm visible-md visible-lg"&gt;
      &lt;div id="fbid"&gt;
          &lt;div id="fb-root"&gt;&lt;/div&gt;
          &lt;div class="fb-post" data-href="https://www.facebook.com/video.php?v=&lt;?php echo $v-&gt;v; ?&gt;" data-width="800"&gt;
              &lt;div class="fb-xfbml-parse-ignore"&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>with this code I can embed facebook videos, if I go directly to my ajax file, <a href="http://foo.com/ajax.php?i=1" rel="nofollow">http://foo.com/ajax.php?i=1</a> it will output that code only for facebook and that is what I get and it display the video correctly, but if I call it using ajax I only see the html but the script doesn't get executed in other words I don't see the video... <br>
  My ajax is this<br></p>
  
  <pre><code>$('.v_list li').click(function(){
      var $ids = $(this).attr('id');
      $.ajax({
          url: "v.php",
          data: {
              vid: $ids
          },
          type: "GET",
          // dataType: "html", // test #7 .. working for all
          context: document.body, // change #8
          success: function (data) {
              $("#slider").html(data);
          },
          error: function (xhr, status) {
              alert("Ocurrio un problema!");
          },
          complete: function (xhr, data) {
              // hide the loading img
          }
      }).done (function (data) {
          // alert('sss'); // This is working...
          $("#slider").find("script").each(function(i) {
              eval($(this).text());
          }); // this p*** of s*** is not working... 
      });
  })
  </code></pre>
  
  <p>So the only problem I got is when the video is for Facebook... how can I solve this?... thanks</p>