I'm looking for a solution to get the value from my radio button and send it to my django url.
When I get selected radio button in the first page of DataTables, it's working properly, However when select radio button from other page (not first page), I can't get the radio button value
HTML
<a href="{% url 'update_maintenance_issue' %}" id="edit">
<img src="{% static 'images/icons/edit3.png' %}">
</a>
<table id="mytable1">
<thead align="center">
<tr align="center" style="font-weight:bold">
<th style="cursor:pointer" align="center">No</th>
<th style="cursor:pointer" align="center">ID</th>
<th style="cursor:pointer" align="center">Type</th>
<th style="cursor:pointer" align="center">Line</th>
<th style="cursor:pointer" align="center">Sequence</th>
<th style="cursor:pointer" align="center">Module</th>
<th style="cursor:pointer" align="center">Item</th>
<th style="cursor:pointer" align="center">Sympton</th>
<th style="cursor:pointer" align="center">status</th>
<th style="cursor:pointer" align="center">Register</th>
<th style="cursor:pointer" align="center">Assigned</th>
<th style="cursor:pointer" align="center">Register dt</th>
</tr>
</thead>
<tbody>
{% for list in issue_list %}
<tr>
<td>
<input name="radio_id" type="radio" id="radio_id" value="{{list.id}}">
</td>
<td align="center">{{ list.id }} </td>
<td align="center">{{ list.line_nm }} </td>
<td align="center">{{ list.line_nm }} </td>
<td align="center">{{ list.sequence}} </td>
<td align="center">{{ list.division }} </td>
<td align="center">{{ list.module }} </td>
<td align="left">{{ list.sympton }}</td>
<td align="left">{{ list.status }}</td>
<td align="center">{{ list.register }}</td>
<td align="center">{{ list.assigned }}</td>
<td align="center">{{ list.register_dt|date:'d/m/Y H:i' }}</td>
</tr>
{% endfor %}
</tbody>
</table>
<!--DataTables-->
<script type="text/javascript">
$(document).ready( function (){
$('#mytable1').DataTable();
});
</script>
<!--Get ID from selected radio button and insert into django "edit" url-->
<script>
$(function(){
$('input[type="radio"]').click(function(){
if ($(this).is(':checked'))
{
let link = $('#edit')
let currentHref = link.attr("href")
let newHref = currentHref.split("?radio_id=")[0] + "?radio_id=" + $(this).val()
link.attr("href", newHref);
}
});
});
</script>
When I'm in the first page, I can get the radio button ID properly, but while I'm in second or higher page, the link "edit" is not passed to the "href="{% url 'update_maintenance_issue' %}" id="edit" "
Is it a Datatable issue or Can I solve by myself?