I'm trying to submit input data but I'd like to submit data of <textarea>
instead of <input>
. My original code:
<form action="/index/output" method="POST">
<input type="text" name="text_box" id="t">
</form>
<script>
$('#t').keyup(function(){
$.ajax({
url : '/index/output',
data : {
text_box : $('input:text').val()
},
success : function(html) {
$('#result').html(html);
}
})
})
</script>
<div id="result"> </div>
I changed <input>
to <textarea>
<form action="/index/output" method="POST">
<textarea name="text_box" id="t"> </text>
</form>
but it does not work well...
Is there a problem with my ajax code?