像這樣的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