I would like to load some text retrieved from a dB into a textarea. The user clicks a link:
<a class="editlink" id="<?php echo $review['id']; ?>" href="#"><?php echo $review['title']; ?></a>
JQuery passes the ID to GO.PHP:
$(".editlink").click(function() {
$.get("go.php", {param: $(this).attr('id')},
function(data) {
$('textarea#area1').html(data);
});
return false;
});
GO.PHP retrieves the text from the dB:
$qry = mysql_query("SELECT * FROM reviews WHERE id = ".$_GET['param']." ");
while($review = mysql_fetch_array($qry)) {
echo $review['description'];
}
As confirmed by Firebug consolle, ID and the text are retrieved correctly. The probelm is that I'm not able to place the text into the textarea:
<textarea id="area1" rows="30" cols="55"></textarea>
I tried: .html(data), .text(data), .val(data) but none display anything. (Please note that the text in the dB may contain HTML tags that I would like to keep).