how i can get the value of input text when enter key pressed in this cod ? .....................................................................
<body>
<div id="center">
<div id="boxtop"></div>
<div id="boxdown">
<input type="text" id="txt"/>
<button type="submit" onclick="SaveData()" id="btn" >SEND</button>
</div>
</div>
<script>
function SaveData() {
work = "insert";
chat = $('#txt').val();
$.ajax({
type: "POST",
url: "server.php",
data: "work="+work+"&chat="+chat,
success: function(msg){
$('#txt').val('');
}
});
}
</script>
</body>