我有一个搜索表,就像-
image here
我尝试做的是在用户更改任何表单元素的值时使用jquery和php获得结果,但我只能在所有这些元素都被视为单个元素并且没有其他选项时才能这样做。但我想在每次表单值发生变化时触发。
google.load("jquery", "1.3.1");
google.setOnLoadCallback(function()
{
// Safely inject CSS3 and give the search results a shadow
var cssObj = { 'box-shadow' : '#888 5px 10px 10px', // Added when CSS3 is standard
'-webkit-box-shadow' : '#888 5px 10px 10px', // Safari
'-moz-box-shadow' : '#888 5px 10px 10px'}; // Firefox 3.5+
$("#suggestions").css(cssObj);
// Fade out the suggestions box when not active
/*$("input").blur(function(){
$('#suggestions').fadeOut();
});*/
});
function lookup(inputString) {
if(inputString.length == 0) {
$('#suggestions').fadeOut(); // Hide the suggestions box
} else {
$.post("regularsearch.php", {queryString: ""+inputString+""}, function(data) { // Do an AJAX call
$('#suggestions').fadeIn(); // Show the suggestions box
$('#suggestions').html(data); // Fill the suggestions box
});
}
}上面是我的一个元素搜索的jquery。如何一次搜索所有内容?
发布于 2012-08-16 22:21:00
这是我写的一个jquery插件,它可能会帮助你解决这个问题。它使用ajax在用户输入时从服务器检索数据。
http://jsfiddle.net/alforno/g4stL/
https://stackoverflow.com/questions/11989073
复制相似问题