title: jQuery on click event handler data is 'undefined' within AJAX handler
body: <p>I have a jQuery event handler function that is triggered on click of two buttons - Positive and Negative. In either case, I pass a different data object to the handler (as below). </p>
  
  <p>I have a AJAX POST within this event handler. However I am unable to access the on click event's data inside the AJAX POST handler. </p>
  
  <pre><code>$('#Positive').on("click", {agree:true}, handlerFunc);
  $('#Negative').on("click", {agree:false}, handlerFunc);
  
  function handlerFunc(e){
      e.preventDefault();
     //e.data is valid here
     if (e.data.agree === true){
          //if condition is valid and it enters this block
          startTimer();
      }
     $.post(url_, postData, function(data){ 
          //console.log(e.data); 
          //e.data is undefined at this point
          if (e.data.agree === false){
               return true; 
          }
          //do other stuff
      });
  }
  </code></pre>
  
  <p>Why is e.data undefined within the AJAX POST? </p>
  
  <p>I created a new variable to store the e.data.agree value and it works as expected. </p>
  
  <pre><code>$('#Positive').on("click", {agree:true}, handlerFunc);
  $('#Negative').on("click", {agree:false}, handlerFunc);
  
  function handlerFunc(e){
      e.preventDefault();
     //e.data is valid here
     var agree_data = e.data.agree;
     if (e.data.agree === true){
          //if condition is valid and it enters this block
          startTimer();
      }
     $.post(url_, postData, function(data){ 
          //console.log(agree_data); 
          //agree_data is valid at this point
          if (agree_data === false){
               return true; 
          }
          //do other stuff
      });
  }
  </code></pre>
  
  <p>Why is e.data undefined in the first case - within the AJAX POST? Does it get overwritten? </p>
  
  <p>NOTE:  <em>I have two different environments and it seems to work fine in the test environment but gives the undefined error in production.</em></p>