GWT:如何使用JSON发送POST跨域请求

编程入门 行业动态 更新时间:2024-10-27 14:32:01
本文介绍了GWT:如何使用JSON发送POST跨域请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

正如其Javadocs所示, JsonpRequestBuilder 只能发送GET请求。我需要使用相同的方法发送POST请求(对于使用JSON的跨域请求)。 有人知道任何有效的解决方案吗?我在网上找不到任何出发点。

As its Javadocs suggest, the JsonpRequestBuilder can only send GET requests. I need to send POST requests using the same method (for cross domain requests using JSON). Does anybody know any working solution? I could not find any starting point on the web.

提前致谢

thanks in advance

推荐答案

你不能使用JSONP来完成一个POST - 它所做的只是插入一个< script src =...> 标记,而浏览器触发了一个GET请求。

You can't use JSONP to do a POST - all it does is inserting a <script src="..."> tag, and the browser fires off a GET request.

也许你正在寻找的是 CORS ,但这仅受FF 3.5,IE 8和Safari 4及更新版本的支持。而且服务器也必须支持它。

Maybe what you're looking for is CORS, but that's only supported by FF 3.5, IE 8 and Safari 4 and newer. And the server must support it, too.

否则,您必须从服务器代理到其他域。

Otherwise, you'll have to proxy from your server to the other domain.

更多推荐

GWT:如何使用JSON发送POST跨域请求

本文发布于:2023-10-10 12:17:21,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1478647.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何使用   GWT   POST   JSON

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!