How would you send ul->li data in a form by Ajax. I want to send all the data in ul ->li by ajax and jquery.
<form id="rightData" method="POST">
<ul class="list-group" id="accordian">
<!-- right list -->
</ul>
<input type="submit" value="submit" name="submit">
</form>
JS Pushing list from json in UL
$.getJSON('https://api.myjson.com/bins/d6n2a', function (data) {
data.topic_info.qt_ct_connection.map(value => {
value.ct_list.forEach((CTLIST, index) => {
$tBody.append(`<li class="list-group-item" id="rl">${CTLIST.ct}
<p id=${index}class="show">
<a href="#demo_${CTLIST.ct}" class="btn btn-danger" data-toggle="collapse">Simple collapsible</a>
<div id="demo_${CTLIST.ct}" class="collapse">
<label>${Object.keys(CTLIST)[2]}</label> <input type="text" value="${CTLIST.tts}><br>
<label>${Object.keys(CTLIST)[1]}</label> <input type="text" value="${CTLIST.topic_level}"><br>
<label>${Object.keys(CTLIST)[4]}</label> <input type="checkbox" ${(CTLIST.to_be_shown_individually && 'checked')} > <br>
<label>${Object.keys(CTLIST)[3]}</label><input type="checkbox" ${(CTLIST.check_for_geometry && 'checked')} > <br>
</div>
</p>
</li>`);
});
how can i use post method to send data un everly
in one click of submitTry to collect all the data with formData and append the ul items' values to it.
https://developer.mozilla.org/en-US/docs/Web/API/FormData/FormData