Alexey, Ah, yes! It probably is asynchronous! I should've thought of that. I restructured the code to look like this:
$(document).ready(function() { $("a").click(function() { var coursename = $(this)[0].attributes['coursename'].nodeValue; var mydata = $.get("http://localhost:8080/course/" + coursename + "/", {}, function(mydata) { var str1 = mydata.substring(5,7); var textAreaNode=document.getElementById('test'); textAreaNode.value += str1; return false; }); return false; }); }); It works. I'm not sure what you're suggesting when you say that I should populate the textarea before assigning to str1, as str1 was what I was populating the textarea with. Regardless, it works, and I'm happy. Thanks.