像这样的jquery代码,我应该如何延迟ajax请求?输入是一个文本字段...在我的头.... thx求助...我应该如何延迟ajax请求?
var proname = "" ;
$("input[name='proname']").keyup(function(e){
//how should i delay this function on here ?
if (e.which == 13) return ;
if ($(this).val() != proname)
{
proname = $(this).val() ;
}
else
{
return ;
}
$.ajax({
type: "post",
data: "proname="+proname+"&page=1",
url: "/project/searchrate",
success: function(view){
alert(view) ;
}
}) ;
}) ;
https://developer.mozilla.org/en/window.setTimeout – Phil