我的客户端代码在名为" POIS"的Parse类中发送要搜索的placeID。如果placeID没有条目,我进行Web查询并返回结果。我的云代码如下。抛出的错误是response.success不是函数
Parse.Cloud.define("returnValues", function(request, response) {
var placeId = request.params.placeId;
var query = new Parse.Query("POIS");
query.equalTo("placeId", placeId);
query.find({
success: function(results) {
if(results.length == 0) {
// Nothing Exist for this placeId
var urlReq = "https://a.b.c.d/retunplaceDetails/search?q=" + placeId";
var request = require('request');
request(urlReq, function (error, rresponse, body) {
if (!error && rresponse.statusCode == 200) {
var res = JSON.parse(body);
var pois = res['data'];
console.log(pois); <======= THIS PRINTS the OUTPUT from WebService
response.success(pois); <====== THIS generates the error
} // valid HTTP Response
else {
console.error(error);
}
}); // request
}
},
error: function() {
console.log("Results returned failed");
}
});
});