I am trying to get the response from the ajax request below. when i remove .sucess{}
, the data table is filtered with the response correctly. But i want to get the data(response) and pass it to variable results
.
How do i get this done please?
$('#statusFilter').on('change', function () {
var results = false;
var filter_value = $(this).val();
dtListUsers.ajax.
url('/user/json/' + filter_value)
.load()
.sucess: function(data) {
results = data;
}
;
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<table id="dtListUsers" class="table">
<thead>
<tr>
<th>Name</th>
</tr>
</thead>
<tbody>
</tbody>
</table>