html - Simple way of displaying images from parse.com database using javascript -
i working on simple page pulls , displays images table in parse.com. not have experience javascript might evident code below.
i need images show in chronological order. current code, works fine of times little buggy.
there 2 main problems:
1) sometimes, randomly, 1 particular new image might not come on top , instead show somewhere in between.
2) page works on firefox , chrome not on ie.
is there better way implement or there should change? appreciated.
page source-
<!doctype html> <head> <meta charset="utf-8"> <title>my parse images</title> <meta name="description" content="my parse app"> <meta name="viewport" content="width=device-width"> <!-- <link rel="stylesheet" href="css/reset.css"> --> <link rel="stylesheet" href="css/styles.css"> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> <script type="text/javascript" src="http://www.parsecdn.com/js/parse-1.2.0.min.js"></script> </head> <body> <div id="main"> <script type="text/javascript"> parse.initialize("xxxxxxxxxxxxxxxxxx", "xxxxxxxxxxxxxxxx"); var config = { parseappid: 'xxxxxxxxxxxxxxxxxxx', parserestkey: 'xxxxxxxxxxxxxxxxxx', streamname: 'parse-demo' }; var getphotos = function() { var userimages = parse.object.extend("userimages"); var query = new parse.query(userimages); query.find({ success: function(results) { $('#photo-container').children().remove(); for(var i=results.length - 1; i>=0; i--){ var img = new image(); img.src = results[i].get("image").url; img.classname = "photo"; document.body.appendchild( img ); } }, error: function(error) { alert("error: " + error.code + " " + error.message); } }); }; function refresh (timeoutperiod){ refresh = settimeout(function(){window.location.reload(true);},timeoutperiod); } $(document).ready(function() { getphotos(); // refresh(10000); }); </script> </body> </html>
internet explorer blocks mixed content. since parse's javascript sdk requires ssl, need host app using https in order access ie.
Comments
Post a Comment