{"id":52998,"date":"2024-12-03T08:38:33","date_gmt":"2024-12-03T00:38:33","guid":{"rendered":"https:\/\/fwq.ai\/blog\/52998\/"},"modified":"2024-12-03T08:38:33","modified_gmt":"2024-12-03T00:38:33","slug":"xmlhttprequest-%e5%8f%91%e9%80%81%e6%95%b0%e6%8d%ae%e4%b8%ad%e7%9a%84-html-%e5%ae%9e%e4%bd%93%e7%bc%96%e7%a0%81%ef%bc%9a%e7%a9%ba%e6%a0%bc%e4%bc%9a%e5%af%bc%e8%87%b4%e5%8f%91%e9%80%81%e5%a4%b1-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/52998\/","title":{"rendered":"XMLHttpRequest \u53d1\u9001\u6570\u636e\u4e2d\u7684 HTML \u5b9e\u4f53\u7f16\u7801\uff1a\u7a7a\u683c\u4f1a\u5bfc\u81f4\u53d1\u9001\u5931\u8d25\uff1f"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>XMLHttpRequest \u53d1\u9001\u6570\u636e\u4e2d\u7684 HTML \u5b9e\u4f53\u7f16\u7801\uff1a\u7a7a\u683c\u4f1a\u5bfc\u81f4\u53d1\u9001\u5931\u8d25\uff1f<\/h1>\n<p>\u6700\u8fd1\u53d1\u73b0\u4e0d\u5c11\u5c0f\u4f19\u4f34\u90fd\u5bf9<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u6587\u7ae0<\/span>\u5f88\u611f\u5174\u8da3\uff0c\u6240\u4ee5\u4eca\u5929\u7ee7\u7eed\u7ed9\u5927\u5bb6\u4ecb\u7ecd<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u6587\u7ae0<\/span>\u76f8\u5173\u7684\u77e5\u8bc6\uff0c\u672c\u6587<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u300aXMLHttpRequest \u53d1\u9001\u6570\u636e\u4e2d\u7684 HTML \u5b9e\u4f53\u7f16\u7801\uff1a\u7a7a\u683c\u4f1a\u5bfc\u81f4\u53d1\u9001\u5931\u8d25\uff1f\u300b<\/span>\u4e3b\u8981\u5185\u5bb9\u6d89\u53ca\u5230<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\"><\/span>\u7b49\u7b49\u77e5\u8bc6\u70b9\uff0c\u5e0c\u671b\u80fd\u5e2e\u5230\u4f60\uff01\u5f53\u7136\u5982\u679c\u9605\u8bfb\u672c\u6587\u65f6\u5b58\u5728\u4e0d\u540c\u60f3\u6cd5\uff0c\u53ef\u4ee5\u5728\u8bc4\u8bba\u4e2d\u8868\u8fbe\uff0c\u4f46\u662f\u8bf7\u52ff\u4f7f\u7528\u8fc7\u6fc0\u7684\u63aa\u8f9e~<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241125\/173252002267442856d357d.jpg\" class=\"aligncenter\" title=\"XMLHttpRequest \u53d1\u9001\u6570\u636e\u4e2d\u7684 HTML \u5b9e\u4f53\u7f16\u7801\uff1a\u7a7a\u683c\u4f1a\u5bfc\u81f4\u53d1\u9001\u5931\u8d25\uff1f\u63d2\u56fe\" alt=\"XMLHttpRequest \u53d1\u9001\u6570\u636e\u4e2d\u7684 HTML \u5b9e\u4f53\u7f16\u7801\uff1a\u7a7a\u683c\u4f1a\u5bfc\u81f4\u53d1\u9001\u5931\u8d25\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>xmlhttprequest \u8bf7\u6c42\u53d1\u9001\u6570\u636e\u4e2d\u7684 html \u5b9e\u4f53\u7f16\u7801\u9650\u5236<\/strong><\/p>\n<p>\u5728\u4f7f\u7528 xmlhttprequest \u53d1\u8d77 post \u8bf7\u6c42\u65f6\uff0c\u901a\u8fc7 setrequestheader \u65b9\u6cd5\u8bbe\u7f6e content-type \u4e3a application\/x-www-form-urlencoded \u65f6\uff0c\u53d1\u9001\u7684\u6570\u636e\u4f1a\u88ab\u7f16\u7801\u6210 url \u7f16\u7801\u683c\u5f0f\u3002<\/p>\n<p>\u5728\u8fd9\u79cd\u683c\u5f0f\u4e2d\uff0chtml \u5b9e\u4f53\u4f1a\u88ab\u7f16\u7801\uff0c\u4f7f\u7528 &lt; \u548c &gt; \u6765\u5206\u522b\u8868\u793a &lt; \u548c &gt;. \u7136\u800c\uff0c\u4e3a\u4e86\u786e\u4fdd\u6570\u636e\u80fd\u591f\u6b63\u786e\u53d1\u9001\uff0c\u9700\u8981\u786e\u4fdd\u8fd9\u4e9b\u5b9e\u4f53\u4e4b\u95f4\u6ca1\u6709\u7a7a\u683c\u3002<\/p>\n<p><strong>\u6848\u4f8b\u8bf4\u660e<\/strong><\/p>\n<p>\u5728\u7ed9\u5b9a\u7684\u793a\u4f8b\u4e2d\uff0c\u5982\u679c &lt; \u548c &gt; \u4e4b\u95f4\u6709\u7a7a\u683c\uff0c\u5219\u53d1\u9001\u7684\u6570\u636e\u7c7b\u4f3c\u4e8e\uff1a<\/p>\n<pre>var data = \"a=a&amp;b=\" + escape(\"&amp;lt; row id='1'&amp;gt;&amp;lt; \/row&amp;gt;\");<\/pre>\n<p>\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0cxmlhttprequest \u4f1a\u6210\u529f\u53d1\u9001\u6570\u636e\u3002<\/p>\n<p><strong>\u95ee\u9898\u539f\u56e0<\/strong><\/p>\n<p>\u7136\u800c\uff0c\u5982\u679c &lt; \u548c &gt; \u4e4b\u95f4\u6ca1\u6709\u7a7a\u683c\uff0c\u5219\u53d1\u9001\u7684\u6570\u636e\u7c7b\u4f3c\u4e8e\uff1a<\/p>\n<pre>var data = \"A=a&amp;B=\" + escape(\"&amp;lt;row id='1'&amp;gt;&amp;lt;\/row&amp;gt;\");<\/pre>\n<p>\u8fd9\u65f6\uff0cxmlhttprequest \u4f1a\u53d1\u9001\u5931\u8d25\uff0c\u63d0\u793a\u5371\u9669\u5b57\u7b26\u3002\u8fd9\u662f\u56e0\u4e3a url \u7f16\u7801\u683c\u5f0f\u9700\u8981 &lt; \u548c &gt; \u4e4b\u95f4\u6ca1\u6709\u7a7a\u683c\uff0c\u5426\u5219\u4f1a\u88ab\u89c6\u4e3a\u65e0\u6548\u7684\u5b9e\u4f53\u3002<\/p>\n<p>\u56e0\u6b64\uff0c\u5728\u4f7f\u7528 xmlhttprequest \u53d1\u9001 html \u5b9e\u4f53\u65f6\uff0c\u9700\u8981\u786e\u4fdd\u8fd9\u4e9b\u5b9e\u4f53\u4e4b\u95f4\u6ca1\u6709\u7a7a\u683c\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u300aXMLHttpRequest \u53d1\u9001\u6570\u636e\u4e2d\u7684 HTML \u5b9e\u4f53\u7f16\u7801\uff1a\u7a7a\u683c\u4f1a\u5bfc\u81f4\u53d1\u9001\u5931\u8d25\uff1f\u300b\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u5173\u4e8e\u7684\u8d44\u6599\u8bf7\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\uff01<\/p>\n<dl>\n<dt><\/dt>\n<dd>\n   \u5c0f\u7a0b\u5e8f\u8868\u683c\u4e2d\u5982\u4f55\u5b9e\u73b0\u6570\u636e\u6362\u884c\u663e\u793a\uff1f\n <\/dd>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>XMLHttpRequest \u53d1\u9001\u6570\u636e\u4e2d\u7684 HTML \u5b9e\u4f53\u7f16\u7801\uff1a\u7a7a\u683c\u4f1a\u5bfc\u81f4\u53d1\u9001\u5931\u8d25\uff1f \u6700\u8fd1\u53d1\u73b0\u4e0d\u5c11\u5c0f\u4f19\u4f34\u90fd\u5bf9\u6587\u7ae0\u5f88\u611f\u5174\u8da3\uff0c\u6240\u4ee5\u4eca\u5929\u7ee7\u7eed\u7ed9\u5927\u5bb6\u4ecb\u7ecd\u6587\u7ae0\u76f8\u5173\u7684\u77e5\u8bc6\uff0c\u672c\u6587\u300aXMLHttpRequest \u53d1\u9001\u6570\u636e\u4e2d\u7684 HTML \u5b9e\u4f53\u7f16\u7801\uff1a\u7a7a\u683c\u4f1a\u5bfc\u81f4\u53d1\u9001\u5931\u8d25\uff1f\u300b\u4e3b\u8981\u5185\u5bb9\u6d89\u53ca\u5230\u7b49\u7b49\u77e5\u8bc6\u70b9\uff0c\u5e0c\u671b\u80fd\u5e2e\u5230\u4f60\uff01\u5f53\u7136\u5982\u679c\u9605\u8bfb\u672c\u6587\u65f6\u5b58\u5728\u4e0d\u540c\u60f3\u6cd5\uff0c\u53ef\u4ee5\u5728\u8bc4\u8bba\u4e2d\u8868\u8fbe\uff0c\u4f46\u662f\u8bf7\u52ff\u4f7f\u7528\u8fc7\u6fc0\u7684\u63aa\u8f9e~ xmlhttprequest \u8bf7\u6c42\u53d1\u9001\u6570\u636e\u4e2d\u7684 html \u5b9e\u4f53\u7f16\u7801\u9650\u5236 \u5728\u4f7f\u7528 xmlhttprequest \u53d1\u8d77 post \u8bf7\u6c42\u65f6\uff0c\u901a\u8fc7 setrequestheader \u65b9\u6cd5\u8bbe\u7f6e content-type \u4e3a application\/x-www-form-urlencoded \u65f6\uff0c\u53d1\u9001\u7684\u6570\u636e\u4f1a\u88ab\u7f16\u7801\u6210 url \u7f16\u7801\u683c\u5f0f\u3002 \u5728\u8fd9\u79cd\u683c\u5f0f\u4e2d\uff0chtml \u5b9e\u4f53\u4f1a\u88ab\u7f16\u7801\uff0c\u4f7f\u7528 &lt; \u548c &gt; \u6765\u5206\u522b\u8868\u793a &lt; \u548c &gt;. \u7136\u800c\uff0c\u4e3a\u4e86\u786e\u4fdd\u6570\u636e\u80fd\u591f\u6b63\u786e\u53d1\u9001\uff0c\u9700\u8981\u786e\u4fdd\u8fd9\u4e9b\u5b9e\u4f53\u4e4b\u95f4\u6ca1\u6709\u7a7a\u683c\u3002 \u6848\u4f8b\u8bf4\u660e \u5728\u7ed9\u5b9a\u7684\u793a\u4f8b\u4e2d\uff0c\u5982\u679c &lt; \u548c &gt; \u4e4b\u95f4\u6709\u7a7a\u683c\uff0c\u5219\u53d1\u9001\u7684\u6570\u636e\u7c7b\u4f3c\u4e8e\uff1a var data = &#8220;a=a&amp;b=&#8221; + escape(&#8220;&amp;lt; row id=&#8217;1&#8217;&amp;gt;&amp;lt; \/row&amp;gt;&#8221;); \u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0cxmlhttprequest \u4f1a\u6210\u529f\u53d1\u9001\u6570\u636e\u3002 \u95ee\u9898\u539f\u56e0 \u7136\u800c\uff0c\u5982\u679c &lt; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-52998","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/52998","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=52998"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/52998\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=52998"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=52998"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=52998"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}