Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

173
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda