live/autocomplete search in cakephp 3.x

Question

i am trying to perform live search in cakephp 3.x , so far i'm able to achieve it by statically defining the data inside the script tag , i want that the data is retrieved from my MySql database, where all the content is stored. Below is the script tag that i have used inside my Template folder.

<script src = "https://code.jquery.com/jquery-1.10.2.js"></script>
<script src = "https://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>

<!-- Javascript -->
<script>
$(function() {
var results = [
"ActionScript",
"Boostrap",
"C",
"C++",
];
$( "#automplete-1" ).autocomplete({
source: results
});
});
<link href = "https://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css"
rel = "stylesheet">
<html>
<body>
<!-- HTML --> 
<div class = "ui-widget">

<?php foreach($data as $row)
{
echo $row->name;
}?>
<p>Type "a" or "s"</p>
<label for = "automplete-1">Tags: </label>
<input id = "automplete-1">
</div>
</body>
</html>


Show source
| cakephp   | jquery   | mysql   | search   | assistive   2016-12-05 10:12 0 Answers

Answers to live/autocomplete search in cakephp 3.x ( 0 )

Leave a reply to - live/autocomplete search in cakephp 3.x

◀ Go back