title: how to add csrf-token to form in js
body: <p>This is the code I have attempted to try and add a csrf token to a javascript form. 
  but it returns "Page Expired"</p>
  
  <pre><code>            var form=document.createElement("form");
              form.setAttribute("method","POST");
              form.setAttribute("enctype","multipart/form-data");
              form.setAttribute("name","MyForm");
              form.setAttribute("action","AddQuestionImage");
              form.setAttribute("onsubmit","return ValidateImageExist()");
              var Input_File=document.createElement("input");
              Input_File.setAttribute("type","file");
              Input_File.setAttribute("name","question_image");
  
              var Token=document.createElement("input");
              Token.setAttribute("type","hidden");
              Token.setAttribute("name","_token");
              Token.setAttribute("value","{{csrf_token()}}");
  
              var Submit=document.createElement("input");
              Submit.setAttribute("type","submit");
              Submit.setAttribute("value","Add Image To Question");
              Submit.setAttribute("class","btn btn-warning");
  
              form.appendChild(Token);
              form.appendChild(Input_File);
              form.appendChild(Submit);
              Div_Control.appendChild(form);
  </code></pre>