2013-05-02 126 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