javascript - Query returns items in console log, but html is showing Uncaught TypeError: Cannot call method 'get' of undefined when trying to display on the page -


parse.com , javascript sdk.

the code queries , returns results should display in id "imgs". @ moment i'm getting

uncaught typeerror: cannot call method 'get' of undefined

error. i've tried, cannot understand whats causing or how fix it.

a url page here http://kudosoo.com/friendslisttest.html

driving me mad...

var currentuser = parse.user.current();   var friendrequest = parse.object.extend("friendrequest");       var query = new parse.query(friendrequest);     query.include('touser');    // query.include('fromuser');     //query.include('pic');     query.equalto("fromuser", currentuser);     query.equalto("status", "request sent");           query.find({               success: function(results) {         // if query successful, store each image url in array of image url's         imageurls = [];         (var = 0; < results.length; i++) {            var object = results[i];           imageurls.push(object.get('pic'));         }      // if imageurls array has items in it, set src of img element first url in array         for(var j = 0; j < imageurls.length; j++){            $('#imgs').append("<img src='" + imageurls[j].get("touser").pic + "'/>");                          }       },       error: function(error) {         // if query unsuccessful, report errors         alert("error: " + error.code + " " + error.message);       }     });          // show signup or login page   </script>  <div id="imgs"></div> 

resolved using.

imageurls = [];         (var = 0; < results.length; i++) {            var object = results[i].get("touser");          imageurls.push(object.get("pic"));         }      // if imageurls array has items in it, set src of img element first url in array         console.log(imageurls);         for(var j = 0; j < imageurls.length; j++){           $('#imgs').append("<img src='" + imageurls[j] + "'/>");                        } 

Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -