I have var row=
and I tried this:val val2
$(\"#mainTable tbody\").append(row);
Try this:
$("#mainTable tr:first").after(row);
http://api.jquery.com/after/
InsertAfter is what you are looking for:
var row='<tr><td>val</td><td>val2</td></tr>';
$(row).insertAfter("#mainTable tr:first");
You can use prepend JQuery method that inserts as the first child:
$("#mainTable tbody").prepend(row);
Prepend documentation