title: How to insert values from text file to JavaScript?
body: <p>Hi I have a text file which consists of pair of latitude,longitudes ,These values need to be inserted into a java script at a particular line How to do that?</p>
  
  <p>Also don't want the double quotes of "latlon" "lat" "lon"</p>
  
  <p>My file content (<code>PointData.txt</code>):</p>
  
  <pre><code>[
   {"latlon":
       {"lon":77.57149375970222,"lat":12.906436894355084},
        "type":"s"
   },
  {"latlon":  
      {"lon":77.56642974908229,"lat":12.8879050148954},
       "type":"s"
  },
  {"latlon":  
        {"lon":77.57149375970222,"lat":12.906436894355084},
         "type":"s"
  },
  {"latlon":
        {"lon":77.5722887689643,"lat":12.906389619827928},
         "type":"s"
   }
  ]
  </code></pre>
  
  <p>servlet: </p>
  
  <pre><code>   protected void doGet(HttpServletRequest request, HttpServletResponse  response) throws ServletException, IOException
      {
          response.setContentType("text/html");    
          PrintWriter out = response.getWriter();    
  
          System.out.println("HI");
          BufferedReader br = new BufferedReader(new FileReader("D:/Workspace/JAVA/VehicleDisplay/RPDATA.txt"));
          try {
              StringBuilder sb = new StringBuilder();
              String line = br.readLine();
  
              while (line != null)
              {
                  sb.append(line);
                  sb.append(System.lineSeparator());
                  line = br.readLine();
              }
              String   value = sb.toString();
               System.out.println(value);
  
  
          } finally {
              br.close();
          }
  
      }
  </code></pre>
  
  <p>JavaScript:</p>
  
  <pre><code> function main()
      {
        var result;
  
          $.ajax({
              url:'insertPos',
          //  data: {data : data},
              type:'get',             
               success:function(value)    
              {
                   result= value;
                   console.log(value);
  
              }
  
          });
  
      }
  </code></pre>