原本覺得會很複雜,原來這麼簡單
php
遠程調用數據jquery
<script src="./static/public/jquery-1.11.0.min.js"></script> <script src="./static/public/jqueryui/jquery-ui.js"></script> <script> $(function() { $( "#goods_name" ).autocomplete({ source: "./index.php?buy/api/?", minLength: 1, }); }); </script> <input id="goods_name">
官方地址:http://jqueryui.com/autocomplete/#remoteapi