title: Is my third party JavaScript returning html or just an empty object?
body: <p>I need to write a function in JavaScript (or jQuery) that checks if a third party injection returns a HTML or nothing at all.</p>
  
  <p>In a minute I will provide further details but a bit of background first.</p>
  
  <p>I have a product details page that needs to display a product information. That product information is supplied from two sources. The better formatted version (with links, videos, fancy boxes, etc...) comes from a third party. The second source is a non-formatted text from CMS.</p>
  
  <p>So what I am trying to achieve is to check if the information coming from the third party has the html, and if so, to display it. If not (or if it returns empty) to display the CMS non-formatted text.</p>
  
  <p>Here is what I have tried:</p>
  
  <pre><code>function flixMediaCallBack(){
      var productDescription = "${productModel.description}";
      var productScript = '&lt;div id="flix-minisite"&gt;&lt;/div&gt; &lt;div id="flix-inpage"&gt;&lt;/div&gt; &lt;script type="text/javascript" src="http://media.flixfacts.com/js/loader.js" data-flix-distributor="6156" data-flix-brand="LG Electronics" data-flix-language="en" data-flix-mpn="55EC930V" data-flix-ean="8806084731074" data-flix-sku="" data-flix-button="flix-minisite" data-flix-inpage="flix-inpage" data-flix-button-image="" data-flix-fallback-language="" data-flix-price=""&gt;';
  
      if (productScript === null) {
          return productDescription;      
      } else if (typeof(productScript) === "object") {
          return productScript;
      } else {    
          return productDescription;
      }
  };
  
   $(document).ready(function() {
  
    var render = flixMediaCallBack(); 
  
    $('#productDetail_tab1')[0].innerHTML = render;
  
   });
  </code></pre>
  
  <p>Where the productScript is the third party script which I have no control over.</p>
  
  <p>No matter what I have tried, I couldn't get the HTML to appear. I did get to the stage where i got the script to appear within the <code>&lt;div id="productDetail_tab1"&gt;&lt;/div&gt;</code>.</p>
  
  <p>Any help will be appreciated</p>