![](/img/trans.png)
[英]Search as you type in Angular to display accurate results when the server doesn't return data in the order it's requested?
[英]javascript to display multiple search results as you type
我遇到了过滤器问题(我想)。 请参见下面的代码和结果。
function getMake(value) {
$.post("../../sql/addVehicleFind.php",{partialMake:value},function(data){
$("#results").html(data);
});
}
function getModel(value) {
$.post("../../sql/addVehicleFind2.php",{partialModel:value},function(data){
$("#results2").html(data);
});
}
<input class="rounded" type="text" name="findMake" onkeyup="getMake(this.value)" placeholder="make"
<?php if(isset($vechileMake) && $vechileMake != '') {echo 'value="'.$vechileMake.'"';} ?> />
<div id="results" style="max-height:200px; overflow:auto; padding-left:55px; text-align: left" ></div>
<input class="rounded" type="text" name="findModel" onkeyup="getModel(this.value)" placeholder="model"
<?php if(isset($vechileModel) && $vechileModel != '') {echo 'value="'.$vechileModel.'"';} ?> />
<div id="results2" style="max-height:200px; overflow:auto; padding-left:55px; text-align: left" ></div>
我的问题是,当我将值放入“ getModel”的第二个输入框中时,我得到了“ getMake”的第二轮结果,如下图所示:
我希望有解决这个难题的方法。 任何帮助,不胜感激。
提前谢谢你
我熟悉php,但不熟悉javascript。 在这里,我展示了我对编程有多少新手。 今天我想到可以过滤函数调用的php代码中的选择。
希望这对处于相同情况的人有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.