HUH函数
可以直接用函数名来赋值给success例如:123</script>$.ajax({url: "demo.php",type: "POST",data:{Name:"keyun"}, success: scss });</script> 当然你也可以二次包装一下ajax这个方法样例如下:12345678910111213141516171819202122<script> var myAjax = function(opt){ $.ajax( { url:opt['url'], type:opt['method'], data:opt['data'], success:function(msg){ opt['callBack'](msg); } }); } var test = function(){ var opt = { url:'demo.php', method:'post', data:{key:'a',value:'1'}, callBack:scss } myAjax(opt);}function scss(res){ alert(res);}</script>希望对你有帮助。