Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
124
rated 0 times [  127] [ 3]  / answers: 1 / hits: 5896  / 10 Years ago, wed, december 10, 2014, 12:00:00

I am trying to get all the values present in my dynamic HTML table and POST the values to AJAX.



I have HTML table like this



enter



When i press '+' , I can able to add rows dynamically . When i click save, How to POST array values from this HTML table to AJAX, so that i can meanwhile INSERT those values into MYSQL



I have tried getting the 'text' of each td present in my table



var rows = $(tbody tr,$(#myTable)).map(function() { 
return [$(td,this).map(function() {
return this.innerHTML;
}).get()];
}).get();


This is getting me -> <input type=text> and so on.


More From » php

 Answers
4

you are returning the innerHTML, which is... HTML.
you can get the value of a input element with .val()
how does this work for you?



return $(td input).map(function() { 
return $(this).val();
});

[#40717] Tuesday, December 9, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
myakylas

Total Points: 66
Total Questions: 85
Total Answers: 95

Location: Guadeloupe
Member since Sat, Aug 22, 2020
4 Years ago
myakylas questions
Thu, Apr 28, 22, 00:00, 2 Years ago
Thu, Apr 8, 21, 00:00, 3 Years ago
Sat, Sep 19, 20, 00:00, 4 Years ago
;