jquery - Appending to HTML a content of a Javascript object -



jquery - Appending to HTML a content of a Javascript object -

trying crack little issue have..

i using parse.com store , retrieve info , have json object trying retrieve part of append html

var tempobject = parse.object.extend("dev"); var query = new parse.query(tempobject); query.notequalto("objectid", "dan stemkoski"); query.find({ success: function(results) { alert("successfully retrieved " + results.length + " receipts"); (var = 0; < results.length; i++) { var object = results[i]; $("#receipts").html(object.get('receipt_title')); console.log(object) //alert(object.id + ' - ' + object.get('receipt_title'));`

the result want show in

<div id = receipts> <div>

unfortunately reason getting 1 line instead of 10 should getting. know should loop somehow results tries have failed me far.

thanks in advance help!

you need add together result html, right replace previous result next one. instead of

$("#receipts").html(object.get('receipt_title'));

try

var html = $("#receipts").html(); $("#receipts").html(html + object.get('receipt_title'));

also, mention, if want efficient might improve maintain adding variable , write dom once. so:

var html = ""; for(/* loop here, thats correct*/){ /*do same apart $("#receipts").html() line*/ html += object.get('receipt_title'); } $("#receipts").html(html);

the less times modify dom, better.

javascript jquery html parse.com

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -