[Solved] Is it possible to update a textarea-element with data from an AJAX call? [closed]


You want a textarea to display the contents of logs.php, and update every 2 seconds. I think this should do it:

<script>

$(document).ready(function(e) {
    $.ajaxSetup({cache:false});
    setInterval(function() {
        $.get('logs.php', function(data) { 
            $('#chatlogs').text(data);
        });
    }, 2000);
});

</script>

<textarea name="" id="chatlogs" style="width:100px; height:100px"></textarea>

Note you also need to add id="chatlogs" to your textarea for this to work. Let me know in the comments if you need more help.

6

solved Is it possible to update a textarea-element with data from an AJAX call? [closed]