2016-03-05 03:16:04 +08:00
|
|
|
<input type="text" name="search" placeholder="输入作业、老师姓名的关键词进行搜索" class="subject-pop-search fr" />
|
|
|
|
<script type="text/javascript">
|
|
|
|
var lastSearchCondition = '';
|
|
|
|
var count = 0;
|
|
|
|
function search_hws(e){
|
|
|
|
if($(e.target).val().trim() == lastSearchCondition && lastSearchCondition != '')
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
lastSearchCondition = $(e.target).val().trim();
|
|
|
|
$.ajax({
|
|
|
|
url: '<%= url_for(:controller => 'users', :action => 'user_search_homeworks') %>'+'?name='+ e.target.value+'&type=<%=type %>&is_import=<%=is_import %>',
|
|
|
|
type:'get'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function throttle(method,context,e){
|
|
|
|
clearTimeout(method.tId);
|
|
|
|
method.tId=setTimeout(function(){
|
|
|
|
method.call(context,e);
|
|
|
|
},500);
|
|
|
|
}
|
|
|
|
|
|
|
|
//查询项目
|
|
|
|
$("input[name='search']").on('input', function (e) {
|
|
|
|
throttle(search_hws,window,e);
|
|
|
|
});
|
|
|
|
|
2016-01-27 17:26:57 +08:00
|
|
|
</script>
|