const http=require('http'); http.createServer((req,res)=>{ res.setHeader('access-control-allow-origin','*'); res.write("{"a":12,"b":"Blue"}"); res.end(); }).listen(8080);
問題:ajax
1.表單提交數據爲何能夠跨域,表單是瀏覽器行爲 規則就能夠跨域 而ajax不能夠 規定的 表單規定的權限可能比 ajax權限大,不過通常ajax請求的都是 API接口只能這麼說,表單提交是理論是能夠任意提交到任意位置。跨域