Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

175
Visualizações
Get value of cell with javascript

I've read multiple answers that seem pretty straightforward, but none are working for me.

I have a javascript table:

$(document).ready(function () {

      var table = $('#data').DataTable({
        ajax: '/api/data',
        columns: [
          {
           className: 'dt-control',
           orderable: false,
           data: null,
           defaultContent: '',
           width:"15px"
          },
          {data: 'Lead ID'},
          {data: 'FirstName'},
          {data: 'Last Name'},
          {data: 'Company / Account'},
          {data: 'Email'},
          {data: 'Work Phone'},
          {data: 'Phone'},
          {data: 'Mobile'},
          {data: 'Create Date'},
          {data: 'Last Modified'},
          {data: 'Lead Status Life Cycle'},
          {data: 'Referring Rep E-Mail'},
          {data: 'Referring Rep Last Name'},
          {data: 'State/Province'},
          {data: 'IRK Sales Rep'},
          {
          className: 'qtemp',
          data: 'DLin'
          },
          {data: 'DLout'}
        ],
      });

And I want to click a cell in the className: 'qtemp' column and return the value, which I then send to a flask app. But I get 'undefined' when I try this:

$('#data tbody').on('click', 'td', function () {
<!--    var layout = $(this).data('rep');-->
        var layout = $(this).innerHTML;
     $.ajax({
      url: "/workstation",
      type: "get",
      data: {layout: layout},
      success: function(response) {
        var new_html = response.html;
        alert(layout);
      },
     });
  });

Is it because the table is produced with JS, and so innerHTML doesn't work?

about 4 years ago · Santiago Gelvez
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda