ExtJS 6.6.0在表单提交中启用CORS [英] ExtJS 6.6.0 Enable CORS in form submit

查看:121
本文介绍了ExtJS 6.6.0在表单提交中启用CORS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在ExtJS 6.6.0

this.getForm().submit({
    url: REST.API_DOMAIN + REST.API_ATTACH + data.id,
    scope: this,
    success: function(form, result) {
        console.info(result);
    },
    failure: function(form, result) {
        console.info(result);
    }
});

尽管REST API是完全跨域的,但ExtJS拒绝响应.

Although the REST API is fully cross-domain, ExtJS rejects the response.

response headers HTTP/1.1 200 OK Date: Wed, 11 Jul 2018 11:41:36 GMT 
Server: Apache Content-Encoding: gzip Vary: 
Accept-Encoding Access-Control-Allow-Origin: * 
Access-Control-Allow-Headers: origin, x-requested-with, content-type 
Access-Control-Allow-Methods: PUT, GET, POST, DELETE, OPTIONS X-Frame- 
Options: ALLOW-FROM app.domain.io 
Content-Length: 1335 
Keep-Alive: timeout=5, max=99 
Connection: Keep-Alive 
Content-Type: application/json; charset=utf-8

推荐答案

要使用跨域请求,您必须使用jsonp;如果仅在开发过程中需要,则可以使用--disable-web-security标志运行chrome. (编辑chrome的快捷方式,然后在目标中添加如下内容:

to use cross domain requests you must use jsonp or if you need it in only development process you can run chrome with --disable-web-security flag. (edit shortcut of chrome and add in target something like this:

C:\ Users {您的用户} \ AppData \ Local \ Google \ Chrome \ Application \ chrome.exe --disable-web-security --user-data-dir ="G:\ chrome")

C:\Users{your_user}\AppData\Local\Google\Chrome\Application\chrome.exe --disable-web-security --user-data-dir="G:\chrome")

这篇关于ExtJS 6.6.0在表单提交中启用CORS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆