title: "[Error] ReferenceError: Can't find variable: data" when trying to get JSON data with AJAX / jQuery request
body: <p>I am getting the error "[Error] ReferenceError: Can't find variable: data" when trying to get JSON data with AJAX / jQuery request.</p>
  
  <p>I have an index.html file which loads jQuery and tries to get data from an ajax.php file.</p>
  
  <p>CONTENT of index.html</p>
  
  <pre><code>$.ajax({
      url : 'ajax.php',
      type : 'POST',
      data : data,
      dataType : 'json',
      success : function (result) {
         alert(result['ajax']);
      },
      error : function () {
          alert("error");
      }
      });
  </code></pre>
  
  <p>CONTENT of ajax.php</p>
  
  <pre><code>$someVariable = array(
      'ajax' =&gt; 'Hello world!'
      );
  echo json_encode($someVariable);
  </code></pre>
  
  <p>Accessing ajax.php through the browser displays the data correctly:</p>
  
  <pre><code>{"ajax":"Hello world!"}
  </code></pre>
  
  <p>What am I missing? Thanks.</p>