can anyone please help me with this? the first if statement works completely fine but the second if is never true meaning that whenever i print 'not' it is fine but when is print 'ok' it's not working and obviously if i use else with the first if then too it's not working
<script type="text/javascript">
    function signupfunction(){
        var name = document.getElementById('signupname').value;
        var email = document.getElementById('signupemail').value;
        var password = document.getElementById('signuppassword').value; 
        $.ajax({
            url : "AdminSignup?name=" + name + "&email=" + email + 
"&password=" + password + "",
            type : "GET",
            async : true,
            success : function(data) {
                if(data == 'not'){
                    alert("Email already exists");
                } 
                if(data == 'ok'){
                    alert('hello');
                }
            }
        });
    }
</script>
here is my doGet() function of servlet
protected void doGet(HttpServletRequest request, HttpServletResponse 
    response) throws ServletException, IOException {
        HttpSession session = request.getSession();
        try {
            Class.forName("com.mysql.jdbc.Driver");
            Connection con = 
                DriverManager.getConnection("jdbc:mysql://localhost/amazon? 
                user=root&password=test123");
            PreparedStatement statement = con.prepareStatement("select * from 
                sellers where email=?");
            statement.setString(1, request.getParameter("email"));
            ResultSet rs = statement.executeQuery();
            if(rs.next()) {
                response.getWriter().print("not");
            } else {
                PreparedStatement statement1 = con.prepareStatement("insert 
                    into sellers(email,password,name) values(?,?,?)");
                statement1.setString(1, request.getParameter("email"));
                statement1.setString(2, request.getParameter("password"));
                statement1.setString(3, request.getParameter("name"));
                statement1.executeUpdate();
                session.setAttribute("sessionAdminEmail", 
                    request.getParameter("email"));
                session.setAttribute("sessionAdminName", 
                    request.getParameter("name"));
                response.getWriter().print("ok");
            }
        } catch (Exception e) {
          }
    }
 
    