$_POST is not working in ajax form submit?

后端 未结 11 1671
遥遥无期
遥遥无期 2021-01-17 12:57

When I try to check user input name is already exist by ajax form submit !But it only get Undefined index: username in sessions.php ,what is missin

11条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-17 13:45

    Use $.post() for ajax :

    $('#confirm').click(function(e){
    
        e.preventDefault();
    
        $.post("sessions.php", $.param($("#saveuser").serializeArray()), function(data) { // use this ajax code
           console.log(data);
        });
    
    });
    

提交回复
热议问题