2013-05-02 164 views

回答

1

monitorthis不指向tr,所以通過tr作爲參數,並試圖

$('#monitor').click(function() { 
    $('#status_table tr').each(function() { 
    $check = $('input:checkbox', this) 
     if ($check.is(':checked')) { 
      monitoring(this); 
     } 
    }); 
}); 

function monitoring(el) { 
    $('#test').append("checked"); 
    fbType = $('td:nth-child(1)', el).html(); 
    fbNum = $('td:nth-child(2)', el).html(); 

    $('#test').append(fbType + fbNum); 

    $.post('/request', { 
     inputText: fbNum, 
     key_pressed: fbType.toString() 
    }).done(function (reply) { 
     if (reply == "on") { 
      $('#test').append("on "); 
     } else { 
      $('#test').append("off "); 
     } 
    }); 
} 
+0

哦,是它的工作原理!再次感謝Arun! :D你幫了我很多!謝謝 :) – yvonnezoe 2013-05-03 00:53:40