Retrieve the Text of a Cell

Retrieve the Text of a Cell

crassydcrassyd Posts: 1Questions: 1Answers: 0
edited December 2016 in Free community support

Hello,

I'm writing code that iterates through a table to update the contents of the cells. A row is set up this way:

<td id="input"><a href="http://www.somelink.com">Input Value</a></td>
<td id="output">Insert Data Here After AJAX Request</td>

My code for selecting the values looks like this:

    table.rows().every( function(rowIdx, tableLoop, rowLoop)
    {
        var in = table.row(this).cell("#input");
        var out = table.row(this).cell("#output");

        if(in[0])
        {
            $.getJSON("/API/" + in.data(), function(data){
            out.data("<a href='/lookup?search_data=" + input.data() + "'>" + data.count + "</a>");});
        }
        this.invalidate();

My issue is that "cell.data()" returns full markup and not just the text of the column.

Is there a way to retrieve just the text ("Input Value" in this example)?
Is there a better way to be doing this?

This discussion has been closed.