title: Axios reload PDF content
body: <p>I need to reload a PDF file inside an embed tag:</p>
  <pre><code>&lt;div class=&quot;row&quot;&gt;
      &lt;div class=&quot;col-sm-12&quot;&gt;
          &lt;div class=&quot;form-group&quot; style=&quot;height: 500px&quot;&gt;
              &lt;label class=&quot;form-label&quot;&gt;Certificado Previo&lt;/label&gt;
              &lt;embed id=&quot;pdfcontainer&quot; type=&quot;application/pdf&quot; width=&quot;100%&quot; height=&quot;100%&quot;&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  <p>This is my Axios JS function:</p>
  <pre><code>function reloadPrevPdf() {
      axios('/draft-copy.pdf/{{$draftCopy-&gt;id}}',{
          method: 'GET',
          responseType: 'blob'
      })
      .then(response =&gt; {
          const filepdf = new Blob(
              [response.data], 
              {type: 'application/pdf'});
          const fileURL = URL.createObjectURL(filepdf);
          document.getElementById(&quot;pdfcontainer&quot;).setAttribute(&quot;src&quot;, fileURL);
      }).catch(function(error) {
          console.log(error);
      });
  }
  </code></pre>
  <p>The route <code>/draft-copy.pdf/{{$draftCopy-&gt;id}}</code> returns a pdf file with <em>php fpdf</em>, the project runs on Laravel 5, but this code is not working, <strong>someone have an idea to this work please?</strong></p>