我将jquery提前自动填充脚本合并到由2个下拉自动提交搜索框组成的现有搜索页面中。那些自动提交使用onchange完成的地方,他们是自我引用。只要用户在第一个下拉列表中选择了该类别,第二个下拉列表返回的页面就会填充不断增加的选项。使用以下代码提交的页面;需要语法将jquery填充字段值携带到下一个表格
<form name="nav"><select name="platform" id="platform" onChange="document.location.href=document.nav.platform.options[document.nav.platform.selectedIndex].value">
当用户选择第一个下拉菜单完成后,页面会自动返回并缩小第二个下拉菜单的结果。问题是第二次下降对用户来说太大了以至于无法操作。
不知道jquery我已经能够提前将自动完成脚本移植到现有的搜索表单中,以替换第二个下拉列表。但是,我无法弄清楚如何将jquery搜索的值传递到同一页面以使php语句执行它。
下面的jquery用我需要结转的记录的id填充第二个字段。这是来自jquery的功能;
<script type="text/javascript">
function lookup(inputString) {
if(inputString.length == 0) {
// Hide the suggestion box.
$('#suggestions').hide();
} else {
$.post("rpc.php", {queryString: ""+inputString+""}, function(data){
if(data.length >0) {
$('#suggestions').show();
$('#autoSuggestionsList').html(data);
}
});
}
} // lookup
function fill(thisValue) {
$('#inputString').val(thisValue);
setTimeout("$('#suggestions').hide();", 200);
}
</script>
这是页面底部的html,最后包含我需要前进的记录的id。
<div>
<form name="dash3.php">
<div>
Start typing the name of the item, select the correct title when it appears:
<br />
<input type="text" name="papa" size="30" value="" id="inputString" onkeyup="lookup(this.value);" onblur="fill();" />
<input type="hidden" value="?list=1" />
</div>
<div class="suggestionsBox" id="suggestions" style="display: none;">
<img src="upArrow.png" style="position: relative; top: -12px; left: 30px;" alt="upArrow" />
<div class="suggestionList" id="autoSuggestionsList">
</div>
</div><input type="submit" value="Submit">
</form>
</div>
坐在页面顶部的php正在寻找这个来触发添加;
if ($_GET['list']==1) {
我需要设置“列表”等于1(你可以看到我想,与隐藏的输入),并且命名为$ VID PHP变量设置为jQuery的类型的内容,提前结果,以便提交按钮将向前传递值,php脚本将执行添加。我试过隐藏的领域,我试过将jquery的各个部分拼凑在一起,但我在java或jquery中没有坚实的基础,我想不出另一种方法来做到这一点。我对每个请求都有了进一步的了解,希望我已经把问题弄得足够好,以便它能够顺利完成!非常感谢。