我有这个问题,我喜欢做的就是没有刷新。我想要的是,当我搜索然后按enter时,播放列表不应该刷新。
我的页面的web示例是http://cocopop12.site11.com/v1.7/index.php
我的jquery脚本正确吗?是否需要使用ajax才能使页面不刷新?
$(function(){
$('input[name="searchsubmit"]').click(function(e) {
e.preventDefault();
var qS = $('#qsearch').val();
$.ajax({
type:"GET",
url:"",
data: qS,
dataype: 'html',
success: function(data){
$('input#qsearch').html(data);
return false;
}
})
});
});该按钮是
<div class="search">
<form id="quick-search" action="" method="get">
<p>
<label for="qsearch">Search:</label>
<input class="tbox" id="qsearch" type="text" name="q" value="Keywords" title="Start typing and hit ENTER" onblur="if(this.value=='') this.value='Keywords';" onfocus="if(this.value=='Keywords') this.value='';" />
<input class="btn" alt="Search" type="image" name="searchsubmit" title="Search" src="./css/search.gif" />
</p>
</form>
</div>谢谢你抽出时间来。
发布于 2012-07-10 19:42:11
尝试success而不是done(),您不能将ajax调用data传递给done()方法:
$.ajax({
type:"GET",
url:"",
data: qS,
datatype: 'html',
success: function(data){
$('input#qsearch').html(data);
}
}).done(function() {
alert('done')
})https://stackoverflow.com/questions/11412503
复制相似问题