title: Why is my website showing a loading icon when every file has loaded successfully?
body: <p>So I was learning JavaScript Promises and created a webpage that shows text derived from another file on the directory. It successfully loads the site and everything, but the problem is that even after the site loading and accessing the data from the other webpage, it is showing the loading icon.
  I tried removing the promise from the file, and when I visited the webpage again, there was no loading icon. So I think there is something wrong with the promise.</p>
  <ul>
  <li><strong>1.</strong> <code>controller.js</code>(The Main JS File)</li>
  </ul>
  <pre><code>function myDisplayer(some) {
    document.write(some);
  }
  async function loadController(){
      let myPromise = new Promise(function(myResolve, myReject) {
        let req = new XMLHttpRequest();
        req.open('GET', &quot;controllerDummy.html&quot;);
        req.onload = function() {
          if (req.status == 200) {
            myResolve(req.response);
          } else {
            myReject(&quot;File not Found&quot;);
          }
        };
        req.send();
      });
      myDisplayer(await myPromise);
  }
  
  loadController()
  </code></pre>
  <ul>
  <li><strong>2.</strong> <code>controller.html</code>(The Main File)</li>
  </ul>
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html style=&quot;background-color: black;&quot;&gt;
  &lt;head&gt;
      &lt;script type=&quot;text/javascript&quot; src=&quot;controller.js&quot;&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <ul>
  <li><strong>3.</strong> <code>controllerDummy.html</code>(The Dummy File from which the promise extracts the response text)</li>
  </ul>
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html style=&quot;background-color: black;&quot;&gt;
      &lt;body&gt;Loading Controller&lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>These are all the files, and now the screenshot(s).<a href="https://i.stack.imgur.com/0wakU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0wakU.png" alt="The webpage, the derived text is black and the bg is black too because I do not like white-colored websites and white UI design" /></a></p>
  <p>As you can see, the promise has loaded, but the site is still loading with the icon. Is there any fix to this?
  Is this way outdated or something?</p>