title: not getting the JSON(Object/Array) from servlet to JSP page
body: <p>I am trying to fetch the value from servlet to JSP page , But I am not able to do it.
  <strong>servlet page</strong> </p>
  
  <pre><code>protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
      String region = request.getParameter("region");
      String secretKey = request.getParameter("secret_key");
      String accessKey = request.getParameter("access_key");
      String VPC = request.getParameter("vpc");   
      LOG.info("region is  "+region);
      if(VPC == null){
          List&lt;String&gt; vpcs = RunEc2Command.getVPCForUSer(accessKey, secretKey, region);
          if(vpcs != null &amp;&amp; vpcs.size() &gt; 0) {
              LOG.info("Number of VPCs: "+vpcs.size());       
              response.setContentType("application/json");
              PrintWriter out = response.getWriter();
              JSONArray jsonAraay = new JSONArray(vpcs);
              LOG.info(jsonAraay);
              out.print(jsonAraay);
              out.flush();
          }
      }
  }
  </code></pre>
  
  <p>and in index.jsp page , I am trying to get the JSONArray value</p>
  
  <pre><code>function getSubnets(){
  var p = document.getElementById("vpc");
  
     var output2 = $.ajax({
       type: 'POST',
       url: 'http://localhost:8066/VMMigratorNew/ec2util',
       data: {
              "vpc":p.value
              },
      dataType:'json',
       success: function(data) {
                          $.each(data.jsaonArray, function(index){
                              var selectBox = "&lt;select&gt;"
                              $.each(data.jsonArray[index], function(key , value){
                                  selectBox+="&lt;option&gt;"+key + "&amp; value" + value + "&lt;/option&gt;";
  
                              });
                              selectbox+="&lt;/select&gt;";
                              $('vpc').html(selectBox);
                          });
              //return output2.responseText;
       }
  });
  </code></pre>
  
  <p>} 
  The Drop down box is not getting populated and the code for drop down box is </p>
  
  <pre><code>&lt;select id="vpc" name="vpc" class="form-control" placeholder="Choose VPC" &gt;
                                          &lt;option value="" default selected&gt;Select VPC&lt;/option&gt;
                                       &lt;/select&gt; 
  </code></pre>
  
  <p>I am new to JSON, Thanks for the help in advance.</p>