我使用jQuery和引导来给下拉搜索suggestions.Following是html代码。但当我在搜索窗体中键入的东西,然后清除窗体。两个窗体apears如图片。为什么?我是jQuery的新手。谢谢你的帮助。为什么会出现两种形式?
<div class="container">
<div class="row">
<div class="span6 offset3">
<form class="form-search">
<input type="text" id="month" name="month" class="input-medium search-query">
<button type="submit" class="btn">Search</button>
<div id="suggestions">
</div>
</form>
</div>
</div>
</div>
<script>
jQuery("#month").keyup(function(){
ajax('search', ['month'], 'suggestions')});
</script>
编辑: 我使用的web2py framwork.This是搜索功能的代码:
def search():
if not request.vars.month: return dict()
month_start = request.vars.month
selected=complete('piracyfinder',month_start) #this line get the search results
return DIV(*[DIV(k['title'],
_onclick="jQuery('#month').val('%s')" % k['title'],
_onmouseover="this.style.backgroundColor='lightblue'",
_onmouseout="this.style.backgroundColor='white'"
) for k in selected])
ajax()函数是什么? – kennypu 2013-03-19 02:09:46