Fetch data by Ajax Loop
- Get link
- X
- Other Apps
<script>
$(document).ready(function() {
// code to get all records from table via select box
$("#event_name").change(function() {
var id = $(this).find(":selected").val();
if (id == '') {
id = 'A'
}
$.ajax({
url: '{{ url('/ajax_event_management/team_creation_list') }}/' + id,
method: 'get',
data: {
id: id
},
cache: false,
success: function(employeeData) {
if (employeeData) {
var html = '';
var serial_no = 1;
if (employeeData.length > 0) {
for (var count = 0; count < employeeData.length; count++) {
html += '<tr>';
html += '<td>' + serial_no + '</td>';
html += '<td>' + employeeData[count].event_name11 + '</td>';
html += '<td>' + employeeData[count].gender11 + '</td>';
html += '<td>' + employeeData[count].category11 + '</td>';
html += '<td>' + employeeData[count].staff + '</td>';
html += '<td>'
+ '<button type="button" class="btn btn-info btn-sm" onclick="delete_function({{ $user->id }})">delete</button>'
+ '</td>';
html += '</tr>'; }
}
$('#tBody').html(html);
} else {
}
}
});
})
});
</script>
- Get link
- X
- Other Apps
Comments
Post a Comment