ajax - Detect Enter key is pressed with jquery -


i have text field showing value. want when user writes new value in text field , presses enter, ajax function triggered pagination operation. have text field this:

<input type="text" id="page" name="page" value="<?php echo($this->pn);?> /> 

and when user writes new value , presses enter, want following ajax function triggered:

 update_ajax2({rpp:<?php echo($this->rpp);?>,pn:document.page.paged.value,filter:'<?php echo($this->filter);?>',orderby:'<?php echo($this->orderby);?>'}); 

i tried using keypress event detect if(e.which===13) doesn't solve problem. can guide me?

<input type="text" id="txt"/>  $('#txt').keydown(function (e){     if(e.keycode == 13){         alert('you pressed enter ^_^');     } }) 

on jsfiddle.


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -