title: Cannot read property 'push' of undefined on array
body: <p>Why do I get this error:</p>
  
  <blockquote>
    <p>Cannot read property 'push' of undefined</p>
  </blockquote>
  
  <p>It seems like I can't push my data to my <code>barcodes</code> array? The <code>console.log(data)</code> works.</p>
  
  <pre class="lang-js prettyprint-override"><code>var myScanObj = {
    $el: null,
    $res: null,
    $searchButton: null,
    $resetButton: null,
    $hiddenInput: null,
    $scanInput: null,
    $selectType: null,
    barcodes: [],
    init: function() {
      myScanObj.cacheDom();
      myScanObj.bindEvents();
    },
    cacheDom: function() {
      $el = $('.formControl');
      $res = $('#result');
      $searchButton = $el.find('#searchButton');
      $resetButton = $el.find('#resetButton');
      $hiddenInput = $el.find('input[name=hiddenField]');
      $scanInput = $el.find('input[name=myScan]');
      $selectType = $el.find('#myType');
    },
    bindEvents: function() {
      $searchButton.on('click', this.addBarcode.bind(this));
    },
    addBarcode: function() {
      var postForm = {
        'myType': $selectType.val(),
        'myScan': $hiddenInput.val()
      };
      $.ajax({
        url: "test.php",
        type: "POST",
        data: postForm,
        dataType: "text",
        success: this.successAjax
      });
    },
    showBarcode: function() {
  
    },
    successAjax: function(data) {
      this.barcodes.push(data);
      console.log(data);
    }
  };
  
  myScanObj.init();
  </code></pre>
  
  <p>This is my test.php code:</p>
  
  <pre><code>&lt;?php
    $output = '';
    $output .= $_POST["myType"];
    $output .= $_POST["myScan"]; 
    echo $output
  ?&gt;
  </code></pre>