1

I have a script file called trim.js. I'm trying to call a function prepareURL() from this file in my index.html file. However I'm getting the following error:

ReferenceError: Can't find variable: prepareURL

I make sure to import my script doing the following:

<script type="text/javascript" src="./js/trim.js">
</script>

<script type="text/javascript">

  $(function() {
    $('#simple_sketch').sketch();
    $('#simple_sketch').sketch('color','#fff');
    $('#simple_sketch').sketch('size','6');         
  });

  function predict() {
    //Create Image URL
    var imageURL = prepareURL('#simple_sketch')
  }

The function in my trim.js file looks like this:

function prepareURL(c) {
  //My code
}

How can I call prepareURL from my index.html file?

Ben Rowe
  • 28,406
  • 6
  • 55
  • 75
KingPolygon
  • 4,753
  • 7
  • 43
  • 72

0 Answers0