var some_id = null; function start_timer(event) { some_id = event.target.parentNode.parentNode.id; timeoutID = window.setTimeout(send_data, 1000); } function send_data() { var text_box = document.getElementById(some_id); var src_url = '/test?command=update&id='+some_id; var text_sending = new Ajax(); text_sending.doPost(src_url,'text',text_box.value); }