• <bdo id='l5354'></bdo><ul id='l5354'></ul>
    1. <tfoot id='l5354'></tfoot>

      <small id='l5354'></small><noframes id='l5354'>

    2. <i id='l5354'><tr id='l5354'><dt id='l5354'><q id='l5354'><span id='l5354'><b id='l5354'><form id='l5354'><ins id='l5354'></ins><ul id='l5354'></ul><sub id='l5354'></sub></form><legend id='l5354'></legend><bdo id='l5354'><pre id='l5354'><center id='l5354'></center></pre></bdo></b><th id='l5354'></th></span></q></dt></tr></i><div id='l5354'><tfoot id='l5354'></tfoot><dl id='l5354'><fieldset id='l5354'></fieldset></dl></div>
      <legend id='l5354'><style id='l5354'><dir id='l5354'><q id='l5354'></q></dir></style></legend>

      1. 通过 JS 中的 XMLHttpRequest 对象发布表单数据?(跨浏

        时间:2023-10-13

        <tfoot id='gGyqP'></tfoot>
          <i id='gGyqP'><tr id='gGyqP'><dt id='gGyqP'><q id='gGyqP'><span id='gGyqP'><b id='gGyqP'><form id='gGyqP'><ins id='gGyqP'></ins><ul id='gGyqP'></ul><sub id='gGyqP'></sub></form><legend id='gGyqP'></legend><bdo id='gGyqP'><pre id='gGyqP'><center id='gGyqP'></center></pre></bdo></b><th id='gGyqP'></th></span></q></dt></tr></i><div id='gGyqP'><tfoot id='gGyqP'></tfoot><dl id='gGyqP'><fieldset id='gGyqP'></fieldset></dl></div>

          <legend id='gGyqP'><style id='gGyqP'><dir id='gGyqP'><q id='gGyqP'></q></dir></style></legend>
            <tbody id='gGyqP'></tbody>
        • <small id='gGyqP'></small><noframes id='gGyqP'>

              <bdo id='gGyqP'></bdo><ul id='gGyqP'></ul>
                  本文介绍了通过 JS 中的 XMLHttpRequest 对象发布表单数据?(跨浏览器)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在尝试在 js 中发布表单数据:

                  我有这个代码:

                  var formData = new FormData();formData.append("用户名", "Groucho");formData.append("accountnum", 123456);formData.append("afile", "2");var xhr = new XMLHttpRequest();xhr.open("POST", "http://xxxxx/xx.ashx",true);xhr.send(formData);

                  根据 )

                  现在跨浏览器 AJAX 文件上传非常困难.您可以尝试在 Javascript 中构建自己的表单标题/边界(请参阅此处的答案:XMLHttpRequest POST multipart/form-data) 但是,我个人认为这不值得.

                  Im trying to post a form data in js :

                  I have this code :

                  var formData = new FormData();
                    formData.append("username", "Groucho");
                    formData.append("accountnum", 123456);
                    formData.append("afile", "2");
                  
                  var xhr = new XMLHttpRequest();
                  xhr.open("POST", "http://xxxxx/xx.ashx",true);
                  xhr.send(formData);
                  

                  Formdata according MDN is not available in IE ( or unknown).

                  When I try this in FF :

                  ( i think its fine...).

                  when I try in IE :

                  What is the solution to post form data ( or my data but in objective way) CROSSBROWSER ?

                  解决方案

                  You didn't say which version of IE you're using. The formData object is not supported in IE9 or lower. XMLHTTPRequest2 (which contains the formData object) should be supported in IE10 (http://caniuse.com/xhr2)

                  Cross-browser AJAX file upload is very hard to do right now. You could try building your own form header/boundaries in Javascript (see answer here: XMLHttpRequest POST multipart/form-data) but, personally, I don't believe it is worth the effort.

                  这篇关于通过 JS 中的 XMLHttpRequest 对象发布表单数据?(跨浏览器)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:是否可以从 beforeSend 回调中修改 XMLHttpRequest 数据 下一篇:如何在 Javascript 中删除 HTTP 特定的标头

                  相关文章

                  最新文章

                • <legend id='L0gje'><style id='L0gje'><dir id='L0gje'><q id='L0gje'></q></dir></style></legend>

                      • <bdo id='L0gje'></bdo><ul id='L0gje'></ul>

                      <small id='L0gje'></small><noframes id='L0gje'>

                    1. <i id='L0gje'><tr id='L0gje'><dt id='L0gje'><q id='L0gje'><span id='L0gje'><b id='L0gje'><form id='L0gje'><ins id='L0gje'></ins><ul id='L0gje'></ul><sub id='L0gje'></sub></form><legend id='L0gje'></legend><bdo id='L0gje'><pre id='L0gje'><center id='L0gje'></center></pre></bdo></b><th id='L0gje'></th></span></q></dt></tr></i><div id='L0gje'><tfoot id='L0gje'></tfoot><dl id='L0gje'><fieldset id='L0gje'></fieldset></dl></div>

                      <tfoot id='L0gje'></tfoot>