Php ajax函数的typeahead引导自动建议
我正在为我的应用程序使用typeahead auto suggestion,但问题是bookingAjaxFunc函数中存在ajax函数,而bookingAjaxFunc代码是 这是我的ajax函数,它在插入、更新、删除和其他情况下运行良好,但是现在我想在typeahead中调用这个函数,我该怎么做呢?我的typeahead函数在预定义的值中运行良好,但是现在我想调用我的bookingaxfunc,我不知道在哪里调用我的函数,记住这个函数是从一个示例复制的,我将它粘贴在这里Php ajax函数的typeahead引导自动建议,php,mysql,ajax,twitter-bootstrap,typeahead,Php,Mysql,Ajax,Twitter Bootstrap,Typeahead,我正在为我的应用程序使用typeahead auto suggestion,但问题是bookingAjaxFunc函数中存在ajax函数,而bookingAjaxFunc代码是 这是我的ajax函数,它在插入、更新、删除和其他情况下运行良好,但是现在我想在typeahead中调用这个函数,我该怎么做呢?我的typeahead函数在预定义的值中运行良好,但是现在我想调用我的bookingaxfunc,我不知道在哪里调用我的函数,记住这个函数是从一个示例复制的,我将它粘贴在这里 function s
function substringMatcher(strs) {
return function findMatches(q, cb) {
var matches, substrRegex;
// an array that will be populated with substring matches
matches = [];
// regex used to determine if a string contains the substring `q`
substrRegex = new RegExp(q, 'i');
// iterate through the pool of strings and for any string that
// contains the substring `q`, add it to the `matches` array
$.each(strs, function (i, str) {
if (substrRegex.test(str)) {
// the typeahead jQuery plugin expects suggestions to a
// JavaScript object, refer to typeahead docs for more info
matches.push({ value: str });
}
});
cb(matches);
};
}
var states = ['Alabama', 'Alaska'];
$('.autoSuggestion').typeahead({
hint: true,
highlight: true,
minLength: 1
},
{
name: 'states',
displayKey: 'value',
source: substringMatcher(states)
});
bookingAjaxFunc函数,它为我的ajax调用创建,因此我使用我的代码将值传递给我的函数并使用我的case
var url = $("#do").val();
bookingAjaxFunc(url, '', 'autoSuggestion');
我还尝试在源代码下添加远程,但没有成功
谢谢这里没有人来解决我的问题吗?有很多代码在讨论中。如果你把它缩小,让别人能更好地理解它,那么你可能会得到很好的答案,尽管我不是打字/引导的人。
var url = $("#do").val();
bookingAjaxFunc(url, '', 'autoSuggestion');