跨域提交表单,前端ajax不用做任何修改,

只需要在后端调用的方法里面添加一行代码即可。

.NET 版

HttpContext.Response.AddHeader("Access-Control-Allow-Origin", "*");//支持全域名访问,不安全,部署后需要固定限制为客户端网址
HttpContext.Response.AddHeader("Access-Control-Allow-Origin", "www.test.com");//只允许test.com跨域提交数据

如果调用跨域调用js方法

需要设置document.domain 

<script>
    document.domain = "qq.com";
</script>

 

JSOP 没用过,查看资料只能GET提交。以上两个解决方案,完美的解决了我的问题,以此记录下。

 

参考:

http://www.cnblogs.com/cdemo/p/5158663.html

 

相关文章:

  • 2022-12-23
  • 2021-12-15
  • 2021-12-07
  • 2021-11-12
  • 2021-06-26
  • 2021-12-17
猜你喜欢
  • 2021-11-04
  • 2021-04-15
  • 2022-12-23
  • 2021-05-12
  • 2021-12-27
  • 2022-02-08
相关资源
相似解决方案