Created
March 10, 2020 17:42
-
-
Save mightyteja/8e18de5e2f4f23656b2ce724558b644d to your computer and use it in GitHub Desktop.
Populating database content in Materialize Autocomplete with Jquery - Laravel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="row"> | |
<div class="col s12"> | |
<div class="row"> | |
<div class="input-field col s12"> | |
<i class="material-icons prefix">textsms</i> | |
<input type="text" id="autocomplete-input" class="autocomplete"> | |
<label for="autocomplete-input">Autocomplete</label> | |
</div> | |
</div> | |
</div> | |
</div> | |
<script> | |
$(document).ready(function(){ | |
var name = {}; | |
var technicians = {!! $technicians->toJson() !!}; | |
for (var i = 0; i < technicians.length; i++) { | |
name[technicians[i].first_name] = null; | |
} | |
$('input.autocomplete').autocomplete({ | |
data : name, | |
minLength: 2, | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment