jquery ajax done() couldn't get outer variable
<pre><code>$('#delete').on('click', function(e){

      var id = '123';

      // layer.confirm('confirm delete？', {
      //     btn: ['ok','cancel'] //buttons
      // }, function(){
          $.ajax({
              type: 'post',
              url: '/test', // ===== could get id =====
              dataType: 'json'
          })
          .done(function(data){
              if(data.code === 1){
                  debugger // ===== could't get id ? ======
                  layer.msg('delete success', {icon: 1});
              }else{
                  layer.msg('success fail', {icon: 1});
              }
          })
          .fail(function(err){
              layer.msg('success fail', {icon: 1});
          })
      // })
    })
</code></pre>

<p>I use $.ajax().done(). when done fired, couldn't get outer variable "id" in line about "debugger"?</p>