• <small id='wukOG'></small><noframes id='wukOG'>

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

          <bdo id='wukOG'></bdo><ul id='wukOG'></ul>
      1. 这个跨域 ajax 请求是如何工作的?

        时间:2023-10-13
        <i id='F8dOh'><tr id='F8dOh'><dt id='F8dOh'><q id='F8dOh'><span id='F8dOh'><b id='F8dOh'><form id='F8dOh'><ins id='F8dOh'></ins><ul id='F8dOh'></ul><sub id='F8dOh'></sub></form><legend id='F8dOh'></legend><bdo id='F8dOh'><pre id='F8dOh'><center id='F8dOh'></center></pre></bdo></b><th id='F8dOh'></th></span></q></dt></tr></i><div id='F8dOh'><tfoot id='F8dOh'></tfoot><dl id='F8dOh'><fieldset id='F8dOh'></fieldset></dl></div>

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

            1. <tfoot id='F8dOh'></tfoot>

                <legend id='F8dOh'><style id='F8dOh'><dir id='F8dOh'><q id='F8dOh'></q></dir></style></legend>
              1. <small id='F8dOh'></small><noframes id='F8dOh'>

                    <tbody id='F8dOh'></tbody>
                  本文介绍了这个跨域 ajax 请求是如何工作的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在查看 这个问题其中有一个指向 http://hacks 的链接.mozilla.org/2011/03/the-shortest-image-uploader-ever/ 有以下代码:

                  I'm looking at this question and in it is a link to http://hacks.mozilla.org/2011/03/the-shortest-image-uploader-ever/ which has the following code:

                  var fd = new FormData();
                  fd.append("image", file); // Append the file
                  fd.append("key", "6528448c258cff474ca9701c5bab6927");
                  // Get your own key: http://api.imgur.com/
                  
                  // Create the XHR (Cross-Domain XHR FTW!!!)
                  var xhr = new XMLHttpRequest();
                  xhr.open("POST", "http://api.imgur.com/2/upload.json"); // Boooom!
                  xhr.onload = function() {
                      // Big win!
                      // The URL of the image is:
                      JSON.parse(xhr.responseText).upload.links.imgur_page;
                   }
                   // Ok, I don't handle the errors. An exercice for the reader.
                   // And now, we send the formdata
                   xhr.send(fd);
                  

                  这个跨域请求是如何工作的?我认为通常会有一些安全限制阻止人们这样做.

                  How does this cross domain request work? I thought as a rule there are security restrictions that stop people from doing just this.

                  推荐答案

                  服务器正在响应 Access-Control-Allow-Origin 设置以允许跨域请求

                  The server is reponding with the Access-Control-Allow-Origin set to allow cross domain requests

                  Response Headers
                  Access-Control-Allow-Origin: *  
                  Cache-Control   max-age=604800
                  Connection  keep-alive
                  Content-Length  494
                  Content-Type    application/json
                  

                  http://www.w3.org/TR/cors/#access-control-allow-origin-response-hea

                  http://hacks.mozilla.org/2009/07/cross-site-xmlhttprequest-with-cors

                  这篇关于这个跨域 ajax 请求是如何工作的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:从 JavaScript Online 访问客户端的“本地主机" 下一篇:IE https CORS XHR 请求因 Script7002 失败:XMLHttpRequest:网

                  相关文章

                  最新文章

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

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

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