概括 :
想要使用 POST 方法将数据发送到另一个域 JSONP。
Code :
$http.jsonp($scope.baseApiUrl+'QueryBuilder/getData?callback=JSON_CALLBACK')
.success(function(data, status, headers, config) {
$scope.success = true;
console.log(data);
}).error(function (data, status, headers, config) {
$scope.error = true;
});
它工作正常。但是我有很多数据需要跨域发送到服务,并且数据太大而无法通过查询字符串发送。所以我想将其作为 JSON 发送。
data: {
"dbName":"test",
"tables":["city","persons"],
"filters":["city_id='Hyd'"]
}
发现 :
如何使用 jQuery 发出指定 contentType 的 jsonp POST 请求? https://stackoverflow.com/questions/3860111/how-to-make-a-jsonp-post-request-that-specifies-contenttype-with-jquery
无法在跨域上使用 JSONP 发布数据 https://stackoverflow.com/questions/18933977/unable-to-post-data-using-jsonp-on-cross-domain
如何使用 JSONP 从 localhost 向domain.com 发送数据 https://stackoverflow.com/questions/18568395/how-to-send-data-using-jsonp-from-localhost-to-domain-com
将 PUT/POST/DELETE 与 JSONP 和 jQuery 结合使用 https://stackoverflow.com/questions/5345493/using-put-post-delete-with-jsonp-and-jquery
每个帖子都表明这是不可能的。那么有没有其他方法可以做到这一点?
问题 :
是否可以将数据发布到 JSONP?或者所有数据都必须作为 GET 请求在查询字符串中传递吗?
任何立即的帮助都将非常感激。谢谢。