javascript - getting the last / newest object from Parse.com -
what have input name , input button save name parse database, on load event pull names database , present them user.
what i'm trying is: when page loaded list of names presented user. , when button clicked add user list , appear when page refreshed.
this live example want without "thomas" being added on , on again in case.
i know used query.first query.find save name database not display it. left in demonstrate i'm trying achieve.
i figured out this question , below working code.
$(window).load(function () { var contact = parse.object.extend("contact"); var query = new parse.query(contact); query.equalto("objectid"); query.find({ success: function (results) { (var = 0; < results.length; i++) { var firstname = document.createelement("label"); firstname.innerhtml = (results[i].attributes.firstname.tostring()); document.getelementbyid("content").appendchild(firstname); var delbtn = document.createelement("button"); delbtn.innerhtml = ("delete"); delbtn.onclick = function () { alert("button onclick"); } document.getelementbyid("content").appendchild(delbtn); var br = document.createelement("br"); document.getelementbyid("content").appendchild(br); } }, error: function (error) { ("error: " + error.code + " " + error.message); } }); });
Comments
Post a Comment