【发布时间】:2015-12-04 21:38:13
【问题描述】:
所以我正在尝试让云代码执行一个 aftersave 事件,该事件会 ping 另一个位置以进行一些数据保存。
它还有一些数据需要发送。
Parse.Cloud.afterSave("ArtPiece", function(request) {
var artistURL = 'http://www.gallery-admin-dev.iartview.com/Gilmans/imageSave.php';
var pieceName = "Robert Rauschenberg Quote";
var url = 'http://www.gilmancontemporary.com/wp-content/uploads/2015/06/Delicate_Garden.The_Bear.48x42.jpeg';
Parse.Cloud.httpRequest({
url: artistURL,
dataType : "text",
crossDomain: true,
type:"GET",
data : {
pieceName : pieceName,
url : url
},
success: function(httpResponse) {
response(httpResponse.text);
},
error: function(httpResponse) {
response('Request failed with response code ' + httpResponse.status)
}
});
});
代码没有给出错误或任何警告。我保存/创建条目工作正常。
Cors 已被处理,因为我可以使用 ajax 脚本成功地进行此调用。
任何线索为什么这不发送? 我可以在解析 httpRequest 中没有数据吗? 不能跨域吗?
或者 有没有办法在 Parse Cloud 之外测试这段代码???
【问题讨论】:
标签: javascript parse-platform cors httprequest parse-cloud-code