久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<tfoot id='NJUL9'></tfoot>

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

        <bdo id='NJUL9'></bdo><ul id='NJUL9'></ul>
    1. <legend id='NJUL9'><style id='NJUL9'><dir id='NJUL9'><q id='NJUL9'></q></dir></style></legend>

    2. <i id='NJUL9'><tr id='NJUL9'><dt id='NJUL9'><q id='NJUL9'><span id='NJUL9'><b id='NJUL9'><form id='NJUL9'><ins id='NJUL9'></ins><ul id='NJUL9'></ul><sub id='NJUL9'></sub></form><legend id='NJUL9'></legend><bdo id='NJUL9'><pre id='NJUL9'><center id='NJUL9'></center></pre></bdo></b><th id='NJUL9'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='NJUL9'><tfoot id='NJUL9'></tfoot><dl id='NJUL9'><fieldset id='NJUL9'></fieldset></dl></div>

        XMLHttpRequest POST 多部分/表單數據

        XMLHttpRequest POST multipart/form-data(XMLHttpRequest POST 多部分/表單數據)
        <legend id='ofXcX'><style id='ofXcX'><dir id='ofXcX'><q id='ofXcX'></q></dir></style></legend>
      1. <i id='ofXcX'><tr id='ofXcX'><dt id='ofXcX'><q id='ofXcX'><span id='ofXcX'><b id='ofXcX'><form id='ofXcX'><ins id='ofXcX'></ins><ul id='ofXcX'></ul><sub id='ofXcX'></sub></form><legend id='ofXcX'></legend><bdo id='ofXcX'><pre id='ofXcX'><center id='ofXcX'></center></pre></bdo></b><th id='ofXcX'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='ofXcX'><tfoot id='ofXcX'></tfoot><dl id='ofXcX'><fieldset id='ofXcX'></fieldset></dl></div>

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

                  <tbody id='ofXcX'></tbody>
                • <bdo id='ofXcX'></bdo><ul id='ofXcX'></ul>
                  <tfoot id='ofXcX'></tfoot>
                  本文介紹了XMLHttpRequest POST 多部分/表單數據的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我想在 JavaScript 中使用 XMLHttpRequest 來發布一個包含文件類型輸入元素的表單,這樣我就可以避免頁面刷新并返回有用的 XML.

                  I want to use XMLHttpRequest in JavaScript to POST a form that includes a file type input element so that I can avoid page refresh and get useful XML back.

                  我可以在不刷新頁面的情況下提交表單,使用 JavaScript 將表單上的目標屬性設置為 MSIE 的 iframe 或 Mozilla 的對象,但這有兩個問題.小問題是目標不符合 W3C(這就是我在 JavaScript 中設置它的原因,而不是在 XHTML 中).主要問題是 onload 事件不會觸發,至少在 OS X Leopard 上的 Mozilla 上不會.此外,XMLHttpRequest 會做出更漂亮的響應代碼,因為返回的數據可以是 XML,而不是像 iframe 那樣僅限于 XHTML.

                  I can submit the form without page refresh, using JavaScript to set the target attribute on the form to an iframe for MSIE or an object for Mozilla, but this has two problems. The minor problem is that target is not W3C compliant (which is why I set it in JavaScript, not in XHTML). The major problem is that the onload event doesn't fire, at least not on Mozilla on OS X Leopard. Besides, XMLHttpRequest would make for prettier response code because the returned data could be XML, not confined to XHTML as is the case with iframe.

                  提交表單會產生如下所示的 HTTP:

                  Submitting the form results in HTTP that looks like:

                  Content-Type: multipart/form-data;boundary=<boundary string>
                  Content-Length: <length>
                  --<boundary string>
                  Content-Disposition: form-data, name="<input element name>"
                  
                  <input element value>
                  --<boundary string>
                  Content-Disposition: form-data, name=<input element name>"; filename="<input element value>"
                  Content-Type: application/octet-stream
                  
                  <element body>
                  

                  如何獲取 XMLHttpRequest 對象的 send 方法來復制上述 HTTP 流?

                  How do I get the XMLHttpRequest object's send method to duplicate the above HTTP stream?

                  推薦答案

                  您可以自己構造 'multipart/form-data' 請求(在 http://www.faqs.org/rfcs/rfc2388.html) 然后使用 send 方法(即 xhr.send(your-multipart-form-data)).同樣,但更簡單的是,在 Firefox 4+(也在 Chrome 5+ 和 Safari 5+)中,您可以使用 FormData 接口,有助于構建此類請求.send 方法適用于文本內容,但如果要發送圖像等二進制數據,可以借助已經開始的 sendAsBinary 方法來完成使用 Firefox 3.0.關于如何通過XMLHttpRequest發送文件的詳細信息,請參考http://blog.igstan.ro/2009/01/pure-javascript-file-upload.html.

                  You can construct the 'multipart/form-data' request yourself (read more about it at http://www.faqs.org/rfcs/rfc2388.html) and then use the send method (ie. xhr.send(your-multipart-form-data)). Similarly, but easier, in Firefox 4+ (also in Chrome 5+ and Safari 5+) you can use the FormData interface that helps to construct such requests. The send method is good for text content but if you want to send binary data such as images, you can do it with the help of the sendAsBinary method that has been around starting with Firefox 3.0. For details on how to send files via XMLHttpRequest, please refer to http://blog.igstan.ro/2009/01/pure-javascript-file-upload.html.

                  這篇關于XMLHttpRequest POST 多部分/表單數據的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Browser waits for ajax call to complete even after abort has been called (jQuery)(即使在調用 abort (jQuery) 之后,瀏覽器也會等待 ajax 調用完成)
                  JavaScript innerHTML is not working for IE?(JavaScript innerHTML 不適用于 IE?)
                  XMLHttpRequest cannot load, No #39;Access-Control-Allow-Origin#39; header is present on the requested resource(XMLHttpRequest 無法加載,請求的資源上不存在“Access-Control-Allow-Origin標頭) - IT屋-程序員軟件開發技術分
                  Is it possible for XHR HEAD requests to not follow redirects (301 302)(XHR HEAD 請求是否有可能不遵循重定向 (301 302))
                  NETWORK_ERROR: XMLHttpRequest Exception 101(NETWORK_ERROR:XMLHttpRequest 異常 101)
                  XMLHttpRequest 206 Partial Content(XMLHttpRequest 206 部分內容)
                • <legend id='fvdDy'><style id='fvdDy'><dir id='fvdDy'><q id='fvdDy'></q></dir></style></legend>

                      1. <small id='fvdDy'></small><noframes id='fvdDy'>

                          • <bdo id='fvdDy'></bdo><ul id='fvdDy'></ul>
                          • <tfoot id='fvdDy'></tfoot>

                              <tbody id='fvdDy'></tbody>
                            <i id='fvdDy'><tr id='fvdDy'><dt id='fvdDy'><q id='fvdDy'><span id='fvdDy'><b id='fvdDy'><form id='fvdDy'><ins id='fvdDy'></ins><ul id='fvdDy'></ul><sub id='fvdDy'></sub></form><legend id='fvdDy'></legend><bdo id='fvdDy'><pre id='fvdDy'><center id='fvdDy'></center></pre></bdo></b><th id='fvdDy'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='fvdDy'><tfoot id='fvdDy'></tfoot><dl id='fvdDy'><fieldset id='fvdDy'></fieldset></dl></div>
                            主站蜘蛛池模板: 亚洲高清av在线 | 夜夜精品视频 | 国产精品成人在线播放 | 羞羞午夜 | 欧美2区 | 五月婷婷导航 | 99久久99热这里只有精品 | 国产在线a | 手机在线一区二区三区 | 国产视频福利一区 | 亚洲成人在线免费 | 91看片在线观看 | 日韩成人免费中文字幕 | a免费视频 | 国产一级在线 | 亚洲精品中文字幕在线观看 | 国产午夜精品一区二区三区 | 成人免费区一区二区三区 | 欧美一区二区三区在线播放 | 久久综合九色综合欧美狠狠 | 欧美在线视频一区二区 | 亚洲成人播放器 | 91嫩草精品| 免费观看的黄色网址 | 超碰97免费 | 毛片免费在线观看 | 综合久久综合久久 | 日本三级播放 | 奇米久久久 | 深夜福利影院 | 亚洲一区二区三区在线播放 | av电影一区二区 | 福利社午夜影院 | 国产高清精品一区二区三区 | 91视频官网 | 中文字幕日韩在线观看 | 美女爽到呻吟久久久久 | 久久久久国产精品一区二区 | 亚洲精品久久久一区二区三区 | 亚洲成人中文字幕 | 欧美黄视频 |