admin管理员组文章数量:1387324
I was looking at the following code at .js
specifically this section,
Chat.fetch = function(callback){
$.ajax({
url: "",
success: function(responseData){
var messageList = [];
var responseMessages = responseData.results;
for (var i = 0; i < 10; i++) {
messageList.push(responseMessages[i].text);
};
//Newest message is at index 0. Reverse message list to add newest messages to the bottom.
callback(messageList.reverse());
}
});
};
I was wondering if anyone could tell me what this .results function does? I have already tried googling and even looked at the jQuery api documentation and can only find a .result function.
"event.result" = The last value returned by an event handler that was triggered by this event, unless the value was undefined.
Is this .result the same as .results?
Thank you
I was looking at the following code at https://github./JosephRobertBrown/HackReactorApplication/blob/master/TakeHomeProject/s.js
specifically this section,
Chat.fetch = function(callback){
$.ajax({
url: "https://api.parse./1/classes/chats?order=-createdAt",
success: function(responseData){
var messageList = [];
var responseMessages = responseData.results;
for (var i = 0; i < 10; i++) {
messageList.push(responseMessages[i].text);
};
//Newest message is at index 0. Reverse message list to add newest messages to the bottom.
callback(messageList.reverse());
}
});
};
I was wondering if anyone could tell me what this .results function does? I have already tried googling and even looked at the jQuery api documentation and can only find a .result function.
"event.result" = The last value returned by an event handler that was triggered by this event, unless the value was undefined.
Is this .result the same as .results?
Thank you
Share Improve this question asked Jul 8, 2013 at 3:30 JaToJaTo 2,8324 gold badges30 silver badges39 bronze badges1 Answer
Reset to default 5responseData.results
is not a function. responseData
is an object that has a key results
, which then also has a key text
which is then being added to an array and sent to a callback function, in reverse.
本文标签: Difference between results function and result function in javascriptjqueryStack Overflow
版权声明:本文标题:Difference between .results function and .result function in javascriptjquery? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744567394a2613134.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论