title: Why is the image not saved if I place the site online (host) but if it is local everything goes well?
body: <p>I'm making a website and I'm trying to allow the user to save an image locally (I don't want it on the server). I have javascript code which works locally for me and I can save the image without any problems. It is displayed on the screen and does not disappear, but if I place it online it does not work.</p>
  
  <p>Online I am getting the console error:</p>
  
  <pre><code>Uncaught ReferenceError: $ is not defined
  at FileReader.reader.onload (VM71:27)
  </code></pre>
  
  <p>HTML code: </p>
  
  <pre><code> &lt;img style="width: 20%;" src="#" id="photo_view" /&gt;
   &lt;input type='file' onchange="readURL(this);" accept="image/*" /&gt;
   &lt;script type="text/javascript" src="http://code.jquery.com/jquery-1.6.4.min.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>Javascript code:</p>
  
  <pre><code>   $("#photo_view").attr("src", localStorage.getItem('savedImage') || '#') // restore
  
  function readURL(input) {
    if (input.files &amp;&amp; input.files[0]) {
      const reader = new FileReader();
  
    reader.onload = function (e) { 
      $(".file-upload-image").attr("src", e.target.result);  
      $(".image-title").html(input.files[0].name);
  
      if (localStorage.getItem('savedImage')) {
        localStorage.removeItem('savedImage');
      }
      localStorage.setItem('savedImage', e.target.result);
    }; 
      reader.readAsDataURL(input.files[0]);
    } 
  } 
  </code></pre>
  
  <p>Where is the mistake and how can I correct it?</p>
  
  <p>Link to the online site: <a href="https://bravojob.000webhostapp.com/" rel="nofollow noreferrer">https://bravojob.000webhostapp.com/</a></p>
  
  <p>There are several other errors in the console, but they appear due to the advertising of the free hosting site.</p>