正如其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跨域请求
发布评论