Hello, I have the following javascript function which is included in a php query and that is executed when giving a keyup in an input how do I execute only when the enter key is clicked?
function insertchat". $row311['k'] ."(){
var dzx='". $row311['k'] ."';
var kmn=$( '#txtContent". $row311['k'] ."' ).val();
var lk='".$_SESSION['k'] ."';
if(kmn!=''){
$.ajax({
type: 'POST',
data: {dzx: dzx, kmn:kmn, lk:lk},
url: 'insertchat4.php',
success: function(datas2){
if(datas2!==''){
$('.m". $row311['k'] ."').append(datas2);
}else{ $('.m". $row2['k'] ."').append('');}
},
error:function(datas2){
},
complete:function(datas2){
}
});
}
}