Have ajax request

$.ajax({ type: "GET", data: data, url: 'ajax_controller', success: [function(responseJson) { $('#results').remove(); var $table = $("<table width=\"100%\" border=\"0\" align=\"start\" id=\"results\">").appendTo($("#matches")); $("<tr>").appendTo($table) .append($("<td>").text('Логин')) .append($("<td>").text('Имя')) .append($("<td>").text('Фамилия')) .append($("<td>").text('Статус')) .append($("<td>").text('Баланс')); $.each(responseJson, function(index, product) { // Iterate over the JSON array. $("<tr>").appendTo($table) .append($("<td>").text(product.login))) // проблемная строка .append($("<td>").text(product.name)) .append($("<td>").text(product.surname)) .append($("<td>").text(product.role)) .append($("<td>").text(product.balance)); }); }] }); 

I receive a list of users and information about each I write to the table.

It is necessary that by clicking on the user login cell (problem line). The user followed the link:

<a href='${pageContext.request.contextPath}/controller?command=go_to_user_profile&login=product.login'> product.login </a>

In the link, as you understand the parameter "product.login" every time a new one.

Can anyone know how to do this?

    1 answer 1

    In the problem line, you need to replace text () with html () and pass your dynamically gathering link there:

     .append($("<td>").html("<a href='${pageContext.request.contextPath}/controller?command=go_to_user_profile&login=" + product.login + "'>" + product.login + "</a>"))// проблемная строка