Php 我可以在jquery中使用一些关于ajaxlivesearch.com函数的建议
我在ajaxlivesearch.com的livesearch.com功能中提供了一个搜索栏 问题是当我点击一个结果时,什么都没有发生。我想在单击结果时发送查询并显示结果页面。在我加入ajaxlivesearch功能之前,我只需输入一个关键字并按下enter键,然后我的结果页面就会出现,这是一个查询。但在我加入ajaxlivesearch功能后,按enter键不再是一个选项,什么也没有发生 我认为问题出在这些jQuery行中Php 我可以在jquery中使用一些关于ajaxlivesearch.com函数的建议,php,jquery,mysql,ajax,livesearch,Php,Jquery,Mysql,Ajax,Livesearch,我在ajaxlivesearch.com的livesearch.com功能中提供了一个搜索栏 问题是当我点击一个结果时,什么都没有发生。我想在单击结果时发送查询并显示结果页面。在我加入ajaxlivesearch功能之前,我只需输入一个关键字并按下enter键,然后我的结果页面就会出现,这是一个查询。但在我加入ajaxlivesearch功能后,按enter键不再是一个选项,什么也没有发生 我认为问题出在这些jQuery行中 jQuery(".mySearch").ajaxlivesearch(
jQuery(".mySearch").ajaxlivesearch({
loaded_at: <?php echo $time; ?>,
token: <?php echo "'" . $token . "'"; ?>,
maxInput: <?php echo $maxInputLength; ?>,
onResultClick: function(e, data) {
// get the index 1 (second column) value
var selectedOne = jQuery(data.selected).find('td').eq('1').text();
// set the input value
jQuery('.mySearch').val(selectedOne);
// hide the result
jQuery(".mySearch").trigger('ajaxlivesearch:hide_result');
},
onResultEnter: function(e, data) {
// do whatever you want
// jQuery(".mySearch").trigger('ajaxlivesearch:search', {query: 'test'});
},
onAjaxComplete: function(e, data) {
// do whatever you want
}
});
jQuery(“.mySearch”).ajaxlivesearch({
加载位置:,
令牌:在您执行任何操作之前,请转到ajaxlivesearch.js文件,并找到这行代码->
// disable the form submit on pressing enter
form.submit(function () {
return false;
});
基本上,当你按下enter键时,它会禁用任何形式的事件,这与你试图做的是相反的
$("#search_ls_query").submit(function(){
return true;
});
现在,(这不是一个完全重要的添加,但是,在“onResulter”区域中提交表单,您可以将其添加到索引页面中
jQuery(document).ready(function(){
jQuery(".mySearch").ajaxlivesearch({
loaded_at: <?php echo $time; ?>,
token: <?php echo "'" . $token . "'"; ?>,
maxInput: <?php echo $maxInputLength; ?>,
onResultClick: function(e, data) {
// get the index 0 (1st column) value
var selectedOne = jQuery(data.selected).find('td').eq('0').text();
// set the input value
jQuery('.mySearch').val(selectedOne);
// hide the result
jQuery(".mySearch").trigger('ajaxlivesearch:hide_result');
},
onResultEnter: function(e, data) {
$("#search_ls_query").submit();
},
/* #search_ls_query is the id of the default form that is submitted when you press enter (Find in ajaxlivesearch.js)*/
onAjaxComplete: function(e, data) {
}
});
这也花了我一段时间才弄明白。但是如果你还在寻找答案,这对我来说很有效。让我知道它是怎么回事!在你做任何事情之前,请转到ajaxlivesearch.js文件,找到这行代码->
// disable the form submit on pressing enter
form.submit(function () {
return false;
});
基本上,当你按下enter键时,它会禁用任何形式的事件,这与你试图做的是相反的
$("#search_ls_query").submit(function(){
return true;
});
现在,(这不是一个完全重要的添加,但是,在“onResulter”区域中提交表单,您可以将其添加到索引页面中
jQuery(document).ready(function(){
jQuery(".mySearch").ajaxlivesearch({
loaded_at: <?php echo $time; ?>,
token: <?php echo "'" . $token . "'"; ?>,
maxInput: <?php echo $maxInputLength; ?>,
onResultClick: function(e, data) {
// get the index 0 (1st column) value
var selectedOne = jQuery(data.selected).find('td').eq('0').text();
// set the input value
jQuery('.mySearch').val(selectedOne);
// hide the result
jQuery(".mySearch").trigger('ajaxlivesearch:hide_result');
},
onResultEnter: function(e, data) {
$("#search_ls_query").submit();
},
/* #search_ls_query is the id of the default form that is submitted when you press enter (Find in ajaxlivesearch.js)*/
onAjaxComplete: function(e, data) {
}
});
这也花了我一段时间才弄明白。但是如果你还在寻找答案,这对我来说很有效。让我知道它是怎么回事