jquery - passing an object through a variable function -
here relatively straightforward code build 2 years ago:
var armed=false; function autosave(){ if(armed){ $('#console').html('submitting..'); $('#autosave').val(1); $.ajax({ url: '/gf5/console/resources/bais_01_exe.php', data: $('#form1').serialize(), method: 'post', }).done(function(data){ //$('#cs').html('saved'); $('#console').html('saved'); armed=false; }); $('#autosave').val(''); }else{ $('#console').html('idle'); } settimeout('autosave()',7000); } function arm(){ armed=true; //$('#cs').html('active'); } $(document).ready(function(){ $('input[type=text],textarea').keyup(arm); $('input[type=checkbox]').click(arm); $('input[type=hidden]').change(arm); $('select').change(arm); settimeout('autosave()',7000); });
i want use specific field submitted, not entire form.#form1 instead of:
$('textarea').keyup(arm);
how pass:
$('textarea').keyup(arm, this);
where = object event came from?
Comments
Post a Comment