$.ajax({
        type:       "post",
        url:        "test.jsp",
        data:           "user="+name.val(),
        success:    function(msg) {
            $('#result').hide();
            $("#result").html(msg)
            .fadeIn("slow"); 
                              if( msg =="available")
                                 {
                                      alert(msg);
                            }
        }
    });
test.jsp
   <h1>
    <%
    String user=request.getParameter("user");
    if(user.equals("prerna"))
    out.print("available");
    else
        out.print("not available");
    %>
   </h1>
i want to compare the value returned by success function to be compared with a string but the above code is not working i also want to add the css class to the "#result" id. the alert box is not comming.
 
     
     
     
     
     
     
     
     
    