分析-未捕获类型错误:无法读取属性'获取'的未定义
Parse - Uncaught TypeError: Cannot read property 'get' of undefined
我正在使用带有javascript的Parse。我正在尝试获取一个对象,并且正在密切关注文档。我仍然以错误结束
未捕获的类型错误:无法读取未定义的属性"get"
$(document).ready(function(){
Parse.initialize("myInfo","myInfo");
var count = Parse.Object.extend('overallCount');
var myQuery = Parse.Query(count);
myQuery.get('Gqwk38uUYz', { //HERE IS THE PROBLEM
success: function(count) {
// The object was retrieved successfully.
var myCount = count.get('count');
var updatedCount = myCount+1;
$("#myNum").val(updatedCount);
count.save(null, {
success: function(count) {
count.set('count', updatedCount);
count.save();
},
error: function(model, error) {
// This will be called.
// error is an instance of Parse.Error with details about the error.
if (error.code === Parse.Error.OBJECT_NOT_FOUND) {
alert("Uh oh, we couldn't find the object!");
} else if (error.code === Parse.Error.CONNECTION_FAILED) {
alert("Uh oh, we couldn't even connect to the Parse Cloud!");
}
}
});
},
error: function(object, error) {
// The object was not retrieved successfully.
// error is a Parse.Error with an error code and message.
}
});
});
您收到错误是因为myQuery确实未定义。您必须使用"new"来创建查询对象。将类名大写也是一种很好的做法:
var Count = Parse.Object.extend('overallCount');
var myQuery = new Parse.Query(Count);
相关文章:
- TypeError:无法读取属性'推'未定义的JavaScript
- 同样,同样的错误'ahorcado.js:26未捕获类型错误:无法读取属性'beginPath'
- 未捕获的TypeError无法读取未定义的属性socialsharing
- 未捕获的类型错误:无法读取属性'删除'的未定义
- AngularJS指令出错-无法读取属性'编译'的未定义
- 未捕获的类型错误:无法读取属性'name'即使它存在,也无法定义
- 看到“;未捕获的类型错误:无法读取属性'weight'未定义的“;尽管按照字面上的指示
- angularjs无法读取未定义的属性then
- 无法读取属性'材料'未定义的Three.js
- 得到"TypeError:无法读取属性'filename'未定义的“;调用“npm start
- Soundcloud api"未捕获的类型错误:无法读取属性'uri'“未定义”;
- 未捕获的类型错误:无法读取属性'addEventListener'的null chrome扩展名
- Soundcloud Javascript SDK 3.0-回调无法读取属性'connectCallback
- 未捕获的类型错误:无法读取属性'状态'在react中为null
- JavaScript承诺-无法读取属性'那么'的未定义
- Javascript Float32数组抛出无法读取属性'0'即使数组定义良好,也为null
- 未捕获的类型错误:无法读取属性'中止'的未定义
- 角度推入数组给出:TypeError:无法读取属性'推'的未定义
- http/rxjs catch回调中的Angular 2重定向导致TypeError:无法读取属性'订阅'
- 角度输入模型有条件地从一个属性读取,写入另一个属性