title: How to fetch DuckDuckGo API
body: <p>i made a single webpage to get <a href="https://api.duckduckgo.com/api" rel="nofollow noreferrer">DuckDuckGo Instant Answer API</a> result,
  <a href="https://adamorielly.github.io/Ducksearch/" rel="nofollow noreferrer">https://adamorielly.github.io/Ducksearch/</a></p>
  <p>But i'm getting 405 Method Not Allowed response when i just tried to make a fetch GET request, Cross-Origin Request Blocked: The Same Origin Policy disallows.</p>
  <p>I guess the purpose of this API is to allow other apps to get search results and render them on their apps,
  am i doing it wrong? , here's my code:</p>
  <pre><code>&lt;section class=&quot;bd-container&quot;&gt;
      &lt;div class=&quot;duck__search&quot;&gt;
          &lt;div class=&quot;form__div&quot;&gt;
              &lt;input type=&quot;text&quot; id=&quot;input1&quot; class=&quot;form__input&quot; placeholder=&quot;enter your search query&quot;&gt;
              &lt;label for=&quot;&quot; class=&quot;form__label&quot;&gt;&lt;/label&gt;
          &lt;/div&gt;
          &lt;input type=&quot;submit&quot; class=&quot;button&quot; id=&quot;form__button&quot; value=&quot;Search&quot;&gt;
          &lt;div class=&quot;duck__result&quot; id=&quot;duck__result&quot;&gt;&lt;/div&gt;
      &lt;/div&gt;
  &lt;/section&gt;
  </code></pre>
  <p>my javascript:</p>
  <pre><code>const searchBtn = document.getElementById('form__button')
  searchBtn.addEventListener('click', () =&gt; {
      let formInputs = document.getElementById('input1').value
      fetch('https://api.duckduckgo.com/?q='+formInputs+'&amp;format=json', {
          method: 'GET',
          headers: {
              'Content-Type': 'application/json'
          }
      }).then(res =&gt; {
          console.log(res.status)
          console.log(res.statusText)
          let result = JSON.parse(res.body)
      }).then(data =&gt; console.log(data)).catch(err =&gt; console.error('err'))
  })
  </code></pre>
  <p>if the API doesn't allow fetch request, is there another way to do it</p>