how to retrieve a value string .val() in a table format (d)

how to retrieve a value string .val() in a table format (d)

santpirsantpir Posts: 3Questions: 2Answers: 0
edited August 2016 in Free community support

I would need to retrieve a value of a variable placed in the child table.
I should retrieve the data and then pass it through a function that takes care of recovering the data and add them in the cart.
this is the simplified function format (d)

function format (d) {
return '<table>'+'<td class="datadb">' + d.datafromdb + '</td></table>'
}

this is the function to add to cart:

$('#tabledata tbody').on( 'click', 'button', function(){ var datafromdb = table.$(this).closest('tr').find('.datadb').val(); // result: undefined var societa = table.$(this).closest('tr').find('.societa').val(); var utente = table.$(this).closest('tr').find('.utente').val(); var name = table.$(this).closest('tr').find('.product-name').text(); var subtotal = table.$(this).closest('tr').find('.subtotal').text(); var quantity = table.$(this).closest('tr').find('input').val(); window.location.href = "add_to_cart.php?societa=<?php echo $s;?>&utente=<?php echo $utente;?>&quantity=" + quantity + "&prod_id=" + iddi + "&name=" + name + "&subtotal=" + subtotal + "&lingua=<?php echo $lingua ?>"+"&sp=<?php echo ($sp); ?>"+"&cp=<?php echo $cp; ?>"; return false; });

Answers

This discussion has been closed.