title: How to return JSON response back from JSP to an $.get() call?
body: <p>In PHP, we return the JSON to an AJAX call like this:</p>
  
  <pre><code>json_encode($data);
  </code></pre>
  
  <p>How do we do that in JSP?</p>
  
  <p><strong>JSP</strong>:</p>
  
  <pre><code>&lt;%      
      gson.toJson(map, System.out);  // last line
  %&gt;
  </code></pre>
  
  <p><strong>jQuery</strong>:</p>
  
  <pre><code>$.get("lookup_all_phone_numbers.jsp")
      .done(function(data){
          $("#results").append(data);
      });
  </code></pre>