title: how to compare response.Text with Some String in ajax
body: <p>I have a problem, I'm returning data from a servlet to an AJAX function and in this function I want to compare the <code>response.Text</code> with some String, e.g x, but it does not compare it. I have the following code;</p>
  
  <pre><code>function ajaxhandler()
  {
      tableHtml=response.Text
      if(tableHtml=='true')
          alert("Valid Move");
      else
          alert("invalid move")
  }
  </code></pre>
  
  <p>but this doesnt alert anything.</p>
  
  <p>in my servlet i had done this;</p>
  
  <pre><code>void myfunction(HttpServlet request,HttpServlet response)
  {
  String user=(session.getAttribute("user"));
  if(user=="john")
  out.println("true");
  else
  out.println("false");
  }
  </code></pre>