I am building a html table based on results I get from an ajax call. I can build the table fine, but I am also trying to put links in the that the user can click on; however, all I am getting is the "text" of the . What am I doing wrong??
here is my ajax code that builds the table
$.ajax({
url: '../Members/GetStatements',
data: 'Year=' + yr,
dataType: 'json',
success: function (data) {
$('#stmtTBL').find('tbody').detach();
$('#stmtTBL').append($('<tbody>'));
$.each(data, function (i, item) {
var linktxt = "";
if (item.DBStored == 1){
//linktxt = '<a href="' + '../members/_ShowStatement?MonthlyStatementID=' + item.MonthlyStatementID + '" target=' + '"_blank"' + '>' + item.StatementName + '</a>'
linktxt = '<a href="#" target=' + '"_blank"' + '>' + item.StatementName + '</a>';
linktxt = '<a href="#">test</a>';
} else {
linktxt = '<a href="' + 'https://www.somelink.com/statements/' + item.FileName + '" target=' + '"_blank"' + '>' + item.StatementName + '</a>';
}
var $tr = $('<tr>').append(
$('<td>').text(linktxt)
).appendTo('#stmtTBL > tbody');
});
I imagine I need to use something like ".append" with an attribute but I dont know the syntax for it, and I am having problems searching for what I want.