Answer the question
In order to leave comments, you need to log in
How to send data using POST method from SPAN?
How to transfer data from a table using the POST method? There are no inputs, there are only spans and td-shki, the input is only for submission.
Answer the question
In order to leave comments, you need to log in
In any case, you will need to somehow indicate what you are going to send in POST. For example, add the data attribute to td <td data-row="3" data-col="2" data-val="456">
. And then on submit, hang up a JS handler that will collect all the data-* information and send it to the server.
But, it's much easier to add <input type="hidden" name="td_1" val="23">
.
JS generate the form and submit it. Or is there no JS either?;) It is
possible through data-attributes (code for jQuery):
<table id="table"><tr><td><span data-id="name">Иван Петрович</span></td></tr></table>
<script>
var form = $('<form />');
$('#table').find("td").each(function(k,v){
$form.append('<input type="hidden" value="' + $(v).find('[data-id=name]').text() + '"');
});
$form.submit();
</script>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question