下面是我可以从数据库中搜索的代码,但我想用OR语句而不是AND语句进行搜索。
var sea=$("#search").val();
var sear=$.trim(sea);
var test = sear.split(" ");
var arrDistinct = new Array();
$(document).ready(function() {
$(test).each(function(index, item) {
if ($.inArray(item, arrDistinct) == -1)
arrDistinct.push(item);
}); //end each
$(arrDistinct).each(function(index, item) {
//database
var db = openDatabase("Database", "1.0", "Inventory", 200000);
db.transaction(function (tx) {
tx.executeSql("SELECT * FROM DEMO WHERE (D_Indications LIKE ?);", ["%"+item+"%"],
for (i = 0; i < len; i++) {
$('#output2').append('<tr><td>'+ results.rows.item(i).Cat_name +'</td><td>'+ results.rows.item(i).Drug_Caty +'</td><td>'+ results.rows.item(i).G_Name +'</td><td>'+ results.rows.item(i).B_Name +'</td><td>'+ results.rows.item(i).D_Indications +'</td></tr>').trigger('create');
}//end for
});//end function
});//end db transaction
}); //end each function
});//document ready
当用户输入“Hello World”时,我希望它使用“%Hello%”或“%World%”搜索数据库 我怎么能用jquery做到这一点?