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

I have a dynamic table as of here As you can see, I have a column for "Status" which i hope to get status reply through this done(function()). This is what i've tried http://jsfiddle.net/yvonnezoe/nbrSR/1/

I set the id for that column as id="status_' + rowID because each row will be different. Then, i find each column of each row by setting a variable

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

After that, i posted that to a python function and it will get a reply of either on or off (for now). In this Fiddle, it won't work because the python function and the real system aren't here. I just want to find out if i'm doing it correct by finding that column and do an .append to show the status? Well, if it is appended to a new div, the on and off can be displayed. But for this one, it never shows up in the table. Why and how should i do it? Will it be updated as well since I'm doing a 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, you have to select an option, key in a number, check the checkbox and press "monitor". It will loop every 5 seconds.

Answers


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

should be

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

instead because eachStatus already included status.

you may want to do an .empty() before the .append() so that new status can replace the previous one.


Need Your Help

What does this compiler build statement mean?

c++ build-process build build-error

I am a programming student in my second OOP class, which is taught in C++, and I am using Visual Studio 2008.

PHP Smarty money_format and a non double string

php smarty

PHP Smarty keeps complaining since my variable money isn't a double that I cant use money_format on it, now I am trying to convert $money into a double, how do I do that?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.