I have var row=valval2 and I tried this:
var row=valval2
$(\"#mainTable tbody\").append(row);
Try this:
$("#mainTable tr:first").after(row);
http://api.jquery.com/after/