javascript - How to insert/update an item in a specific column of a dynamic table? -


i have dynamic table of here can see, have column "status" hope status reply through done(function()). i've tried http://jsfiddle.net/yvonnezoe/nbrsr/1/

i set id column id="status_' + rowid because each row different. then, find each column of each row setting variable

eachstatus = $row.find('td:nth-child(5)').attr('id'); 

after that, posted python function , reply of either on or off (for now). in fiddle, won't work because python function , real system aren't here. want find out if i'm doing correct finding column , .append show status? well, if appended new div, on , off can displayed. one, never shows in table. why , how should it? updated since i'm doing setinterval, looping every 5 seconds?

    $.post('/request', {     inputtext: fbnum,     key_pressed: fbtype.tostring()}).done(function (reply) {     if (reply == "on") {         $('#status_table tr #status_' + eachstatus).append("on ");     } else {         $('#status_table tr #status_' + eachstatus).append("off ");     }     }); 

fyi, have select option, key in number, check checkbox , press "monitor". loop every 5 seconds.

$('#status_table tr #status_' + eachstatus).append("on "); 

should be

$('#status_table tr #' + eachstatus).append("on "); 

instead because eachstatus included status.

you may want .empty() before .append() new status can replace previous one.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -