Textarea post and set return data back into the textarea

So currently i need to post the values of the textarea on the keypress of enter. After that i must set the return values in the textarea. I have failed many many times. So i hope someone can help me.


$(document).keypress(function(e) {
  			if (e.keyCode == 13 && !e.shiftKey) {
    		                e.preventDefault();
				var te = $('textarea').val();
    			        $.post('includes/request.php' , {name: "value" ,value: te} , function(data){$('textarea').text(data);});
  			}
});

You need to use $(‘textarea’).val()

text() is used to get the innerHTML, stripped of tags, of an element. However, textarea has no innerHTML per se and instead has a “value” property. So that’s why you need to use .val(). text() will work until the textarea’s value gets changed (either manually or programmatically) which is why it “sometimes” works and sometimes doesn’t.

I know, confusing.