0
Jquery的自動完成不適用於我,但我沒有得到任何錯誤。我已經在我的網站的空白頁面上測試了這些代碼,它已經工作,這導致我相信下面的東西是相互衝突的。自動完成不工作,沒有錯誤
的Javascript:
$("#search").autocomplete({
source: function(request, response) {
$.ajax({
url: "/candidates/search.json?name=" + request.term,
dataType: "json",
data: {
term: request.term
},
success: function(data) {
alert();
response(data.data.map(function(value) {
return {
'label': value.FormattedName,
'id': value.id,
'value': value.FormattedName
};
}));
}
});
},
minLength: 1,
select: function(event, ui) {
window.location.href = "/candidate/" + ui.item.id;
}
});
jQuery包含
<%@include file="body-scripts-start.jspf" %>
<script src="assets/vendor/jquery-ui-touch-punch/jquery.ui.touch-punch.js"></script>
<script src="assets/vendor/jquery-appear/jquery.appear.js"></script>
<script src="assets/vendor/bootstrap-multiselect/bootstrap-multiselect.js"></script>
<script src="assets/vendor/jquery-easypiechart/jquery.easypiechart.js"></script>
<script src="assets/vendor/flot/jquery.flot.js"></script>
<script src="assets/vendor/flot-tooltip/jquery.flot.tooltip.js"></script>
<script src="assets/vendor/flot/jquery.flot.pie.js"></script>
<script src="assets/vendor/flot/jquery.flot.categories.js"></script>
<script src="assets/vendor/flot/jquery.flot.resize.js"></script>
<script src="assets/vendor/jquery-sparkline/jquery.sparkline.js"></script>
<script src="assets/vendor/raphael/raphael.js"></script>
<script src="assets/vendor/morris/morris.js"></script>
<script src="assets/vendor/gauge/gauge.js"></script>
<script src="assets/vendor/snap-svg/snap.svg.js"></script>
<script src="assets/vendor/liquid-meter/liquid.meter.js"></script>
<script src="/assets/javascripts/dashboard.js"></script>
<script src="/assets/vendor/jquery-datatables/media/js/jquery.dataTables.js"></script>
<script src="/assets/vendor/jquery-datatables-bs3/assets/js/datatables.js"></script>
體的腳本,start.jspf
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<link href="http://code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css" rel="Stylesheet"></link>
<script src="/assets/vendor/jquery-browser-mobile/jquery.browser.mobile.js"></script>
<script src="/assets/vendor/bootstrap/js/bootstrap.js"></script>
<script src="/assets/vendor/nanoscroller/nanoscroller.js"></script>
<script src="/assets/vendor/magnific-popup/magnific-popup.js"></script>
<script src="/assets/vendor/jquery-placeholder/jquery.placeholder.js"></script>
<script src="/assets/vendor/pnotify/pnotify.custom.js"></script>
<script src="/assets/vendor/handlebars/handlebars-v2.0.0.js"></script>
<script src="/assets/vendor/momentjs/moment.min.js"></script>
<sec:authorize access="isAuthenticated()">
<script src="/assets/javascripts/common.js"></script>
<script src="/assets/vendor/sockjs/sockjs-0.3.4.min.js"></script>
<script src="/assets/vendor/stompjs/stomp.min.js"></script>
<script src="/assets/javascripts/notifications.js"></script>
</sec:authorize>