Controller passes a null to ajax.

success : function(data) {
                /* alert(data);
                alert(typeof data); */
                
                 if(!data){
                 alert("");
                 return false;
                 } else {
                 alert(typeof data); 
                 alert("");
                 return false;
                 } 
            }

how to judge the if when null, is sent back to the background. If it is a blank prompt box
the prompt box will only pop up if the value is returned now, and there will be no prompt box when it comes back to null

.
Sep.06,2021

now the console confirms whether it is the string null or null type

var flag = true;
var student_id = $('input[name="student_id"]').val();//input
            //alert(student_id);
            $.ajaxSetup({
                  async: false//
                  });
            $.post("<%=basePath%>user/queryByID", {student_id : student_id},function(data){
                //alert(data);
                if (!data) {//
                    alert("");
                    flag = false;
                    //alert(flag);
                }
            });
        //alert("======"+flag);
        return flag;
Menu