title: ReferenceError: <Function> is not defined
body: <p>I am getting a <code>ReferenceError: serializeProducts is not defined</code> error in my console and not sure why. </p>
  
  <ul>
  <li>I have a Javascript file called <code>components.js</code> that contains a function called <code>serializeProducts</code>.</li>
  <li><p>A template calls this <code>components.js</code> script and then a script below uses the <code>serializeProducts</code> function. </p>
  
  <pre><code>    &lt;script type="text/javascript" src="{{STATIC_URL}}js/components.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript"&gt;
       if($("#parsed_found").val() == undefined)
          items_found = ""
      else
          items_found = serializeProducts($("#parsed_found").val().split("\n"));
  
      if($("#parsed_not_found").val() == undefined)
          items_not_found = ""
      else
          items_not_found = serializeProductsNotFound($("#parsed_not_found").val().split("\n"));
  </code></pre>
  
  <p>Notes</p></li>
  <li><p><code>components.js</code> is definitely being found properly as I can access through console, 200 status, etc.</p></li>
  <li>I am not getting the error when running the script locally, but when I load the <code>components.js</code> file from Amazon S3 this is when it seems to not work, which I am having trouble figuring out as the permissions are public.</li>
  </ul>
  
  <p>I am wondering if this could be an issue with the <code>components.js</code> script not loading fully before the script on the page runs? I've tried adding a delay, but still am getting the error. Any other ideas?</p>
  
  <p>components.js: <a href="http://snapeda.s3.amazonaws.com/js/components.js" rel="nofollow">http://snapeda.s3.amazonaws.com/js/components.js</a></p>