var title = 'blog'; (function(title){ $.post(url, {}, function(data){ alert(title);//output single's blog, 我们期望的是输出 blog }) }(title)) title = "single's blog"; (function(title){ $.post(url, {}, function(data){ alert(title);//output single's blog }) }(title)) for(var i=0;i<3;i++) { ((function(i){ $.get('/?'+i, {}, function(data){ alert(i); // alert(1) alert(2) alert(3) }) }(i)) }