Made Live search is done

This commit is contained in:
2020-07-27 16:03:49 +02:00
parent f1fb73beec
commit b9633d36a9
12 changed files with 296 additions and 5 deletions
@@ -10,8 +10,15 @@
@endsection
@section("content")
<script src="http://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
<div class="row align-items-center">
<a class="btn btn-inline btn-sde-blue mb-0" href="{{ route('menu-plans.create') }}"><img src="{{ asset('/images/icons/plus.svg') }}" alt="Create">Opret Menuplan</a>
<form method="post" action="{{ route("menu-plans.store") }}">
@csrf
<input type="number" class="form-controller" id="search" name="search" pattern="[0-9]{2}" placeholder="Søg efter ugenummer"></input>
</form>
</div>
<table class="tbl mt-2">
<tr>
@@ -43,4 +50,24 @@
</table>
{{ $menuPlans->links() }}
<script>
$('#search').on('keyup', function () {
$value = $(this).val();
$.ajax({
type: 'get',
url: '{{route('menu-plans.search')}}',
data: {'search':$value},
success:function (data) {
$('tbody').html(data);
},
error:function (data) {
console.log(data);
}
});
})
</script>
@endsection