connorb08 connorb08 - 1 month ago 5
Javascript Question

AJAX: Update textarea on page without reloading

I'm trying to update a textarea on my webpage when a form is submitted without refreshing the whole page. I've tried using AJAX like this:

$("#db_info").load(document.location.href + ' #db_info');

but when I submit the form, instead of just updating the text in the textarea, it creates a new nested text area inside of it, and causing it to appear blank. How can I update the textarea without reloading the page completely?

I figured it out finally. What I used is:

$.get("", function(data){
document.getElementById("db_info").innerHTML = $(data).find('#db_info').html();


I didn't really understand your question but if you want to change the value of a textarea you should do this: