title: Is it possible to invoke sound from the JS file in Django's HTML template without Ajax?
body: <p>I'm in the middle of migrating a site to <strong>Django</strong> framework. Almost all <strong>JS</strong> scripts works, except those related to sound.</p>
  <p>I have a play/pause button for a song and some sounds invoked when the mouse is hovering over particular buttons. For just those files I received from the console:</p>
  <p><a href="https://i.stack.imgur.com/J7HBE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/J7HBE.png" alt="enter image description here" /></a>
  Of course, those files are in <code>/static/hangman_game/</code> folder.</p>
  <p>Other static files (js, css) work.
  Is it possible to somehow activate those functions related to playing sound/music without <strong>Ajax</strong>?</p>
  <p>Function in Django's template html is <code>onclick=&quot;togglePlay()</code>.</p>
  <p>Variables and functions used in <strong>JS</strong> file:</p>
  <pre><code>var yes = new Audio(&quot;yes.wav&quot;);
  var no = new Audio(&quot;no.wav&quot;);
  
  
  var myAudio = new Audio('John Jacob Niles - The Maid Freed From The Gallows (1940).mp3');
  
  function togglePlay() {
    if (isPlaying) {
      myAudio.pause()
    } else {
      myAudio.play();
    }
  };
  myAudio.onplaying = function() {
    isPlaying = true;
  };
  myAudio.onpause = function() {
    isPlaying = false;
  };
  
  function checkIt(num)
  {
      var matched = false;
  
      for (i=0; i&lt;lengthPass; i++)
      {
          if(pass.charAt(i) == letters[num])
          {
              //// alert(i); //Test
              pass1 = pass1.setCharacter(i, letters[num]);
              matched = true;
          }
      }
      if(matched == true)
      {
          yes.play();
          var element = &quot;let&quot; + num;
          document.getElementById(element).style.background = &quot;#003300&quot;;
          document.getElementById(element).style.background = &quot;#00C000&quot;;
          document.getElementById(element).style.background = &quot;3px solid #00C000&quot;;
          document.getElementById(element).style.background = &quot;default&quot;;
  
          updatePass();
      }
      else
      {
          no.play();
      }
  </code></pre>