<script>
$('#form button[type=button]').click(function() {
$.ajax({
type: 'POST',
url: 'chat.php',
data: $('#form').serialize() + '&' + this.name + '=' + this.value,
success: function(text) {
console.log(data);
}
});
});
</script>