how to use hyperlink in JQuery in one column of a table

88 Views Asked by At
$(document).ready(function() {
  $("#search_btn").click(function() {
    var _empID = document.getElementById('search').value;
    $.ajax({
      url: 'coinsIndentsServlet?empid=' + _empID,
      type: 'GET',
      dataType: 'json',
      timeout: 2500,
      "columns": [{
        "data": "INDENTNO",
        "render": function(data, type, row, meta) {
          return '<a href="Test.html' + data + '">' + data + '</a>';
        }
      }],
      success: function(response) {
        $('#table').bootstrapTable('load', response.indents);
        $('#tabledata').bootstrapTable('load', response.egps);
      }
    });
  });
});

how to hyperlink one column in mdbootstrap using jquery . here iam using this above code but iam not getting the hyperlink . i need only one column to be hyperlinked.

1

There are 1 best solutions below

4
On

You should change a little thing:

      return '<a href="Test.html' + data + '">' + data + '</a>';

to

      return '<a href="Test.html?test_id=' + data + '">' + data + '</a>';

Output:

if data = "1":

<a href='Test.html?test_id=1'>1</a>

you should find a better title for the link