title: Is There any way to do the same role that the method .load() in jquery does to get part of html page with vanilla Javascript
body: <p>I'm learning Ajax now and I have a problem finding videos or articles that use just javascript to do things that jquery does.
  To load apart from an HTML page and put it on the page, using jquery it is just like that :</p>
  <pre><code>   $(function () {
        $(&quot;#showData&quot;).load(&quot;pageName.html #whatIWant&quot;);
      });
  </code></pre>
  <p>And the Data in #whatIWant will be in element with #showData id.
  I can't figure how to do the same thing with Vanilla Js
  thanks for your participation.</p>
  <p>NOTE :
  If I use the method below, I get all the data from the other page and I want to control the response.</p>
  <pre><code>const getData = (url) =&gt; {
    return new Promise((resolve, reject) =&gt; {
      let request = new XMLHttpRequest();
      request.onload = function () {
        if (this.readyState === 4 &amp;&amp; this.status === 200) {
          resolve(this.responseText);
        } else {
          reject(this.responseText);
        }
      };
      request.open(&quot;get&quot;, url, true);
      request.send();
    });
  };
  
  getData(&quot;test.html&quot;)
    .then((resolve) =&gt; {
      console.log(resolve);
    })
    .catch((reject) =&gt; {
      console.error(reject);
    });
  </code></pre>