title: Why am I getting the html tags from jQuery and HttpHandler?
body: <p>I have the following code :</p>
  
  <pre><code> &lt;script&gt;
   $(document).on('click','#Save',function()
   {
     $.get('My_App?New_Info='+$('button[id^=\"Current_\"]').text(),function(responseText)
     {
       $('#Page_div').text(responseText);
     });
   });
   &lt;/script&gt;
  </code></pre>
  
  <p>The html looks like this :</p>
  
  <pre><code>&lt;div id=Page_div&gt;
        &lt;Table Border=1&gt;
          &lt;Tr&gt;
            &lt;Td&gt;&lt;button id=Current_1 type=button&gt;&lt;/button&gt;&lt;/Td&gt;
            &lt;Td&gt;&lt;button id=Current_2 type=button&gt;&lt;/button&gt;&lt;/Td&gt;
            &lt;Td&gt;&lt;button id=Current_3 type=button&gt;&lt;/button&gt;&lt;/Td&gt;
            &lt;Td&gt;&lt;button id=Current_4 type=button&gt;&lt;/button&gt;&lt;/Td&gt;
            &lt;Td&gt;&lt;button id=Current_5 type=button&gt;&lt;/button&gt;&lt;/Td&gt;
            &lt;Td&gt;&lt;button id=Current_6 type=button&gt;&lt;/button&gt;&lt;/Td&gt;
            &lt;Td&gt;&lt;button id=Save type=button&gt;Save&lt;/button&gt;&lt;/Td&gt;
          &lt;/Tr&gt;
        &lt;/Table&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>And the <code>HttpHandler</code> code looks like this :</p>
  
  <pre><code>  public void handle(HttpExchange exchange)
    {
      OutputStream responseBody=exchange.getResponseBody();
      String requestMethod=exchange.getRequestMethod(),requestPath=exchange.getRequestURI().getPath(),title="ABC",
               New_Info,responseString="&lt;Html&gt;\n&lt;Head&gt;\n  &lt;Title&gt;"+title+"&lt;/Title&gt;\n&lt;/Head&gt;\n&lt;Body BgColor=#FDF5E6&gt;\n&lt;Center&gt;\n"+Get_jQuery()+"\n\n";
      LinkedHashMap&lt;String,String&gt; params=queryToMap(exchange.getRequestURI().getRawQuery());
      File file;
  
      try
      {
        New_Info=(params.get("New_Info")==null?null:URLDecoder.decode(params.get("New_Info"),"utf-8"));
  
        if (New_Info!=null)                                                                    // After Save button is clicked, save new user info
        {
          Headers responseHeaders=exchange.getResponseHeaders();
          responseHeaders.set("Content-Type","text/html;charset=utf-8");
          exchange.sendResponseHeaders(200,0);
          responseString="&lt;P&gt;&lt;H2&gt;Info [ "+New_Info+" ] saved.&lt;/H2&gt;";
          responseBody.write(responseString.getBytes());
        }
  ...
  }
  </code></pre>
  
  <p>All is well, except one thing, the buttons are replaced with new text from <code>HttpHandler</code>, which is the string : <code>"&lt;P&gt;&lt;H2&gt;Info [ xx ] saved.&lt;/H2&gt;"</code></p>
  
  <p>But I expect it to be in big fonts and the text on the screen should be : "Info [ xx ] saved." rather than the RAW un-rendered version showing user the html tags, why ? I also tried :</p>
  
  <p>responseHeaders.set("Content-Type","text/plain");</p>
  
  <p>No difference, I also tried to put <code>&lt;html&gt; ... &lt;/Html&gt;</code> around it, still didn't work, what's the correct way to fix it ?</p>