按下后退时,在多相表单上释放php echo消息

<?php
$result_username=mysqli_query( $dbc, $query_fetch_username);


        if(mysqli_num_rows($result_username)){

            echo "There is already a user with that username!";

            return;

        }
//Section of php code that echo the request;

?>

<script>
function processBack(x){


_("phase1").style.display="block";
_("show_all_data").style.display="none";
_("progressBar").value=0;
_("status").innerHTML="Applicant's Information";


    }
//That's the code for the back button;
</script>

<script>
$(function(){
$(document).on("click", ".reg", function(e) {
e.preventDefault();
{       
//This is the ajax that will capture all the inputs from the form 
var infom = $("#msform").serialize();
        //$("#showresult").addClass('loader');                
        $.ajax({            
            beforeSend: function() { },         
            type: "POST",
            url: "http://localhost/registration_sub.php",
            data:infom,          
            success: function(result){      
            //$("#showresult").removeClass('loader');
            $('#showresult').html(result);
            }
        });     
        e.preventDefault(); 
}
}); 
});
</script>   

I have some php & JavaScript code I created a multiphase form that has two steps step1 and step2. if I enter something wrong or leave input fields blank it displays a error message on the step2 no when I press back and correct that issue then select next it keeps showing the same messages. How do I clear the message when I select back and correct the issue then press next?

<script type="text/javascript">

    $(document).ready(function(){ 
       $('#reset').click(function(){

document.getElementById("showresult").style.display="none";
  });
        });
$(document).ready(function(){ 
       $('.reg').click(function(){

document.getElementById("showresult").style.display="block";
  });
        });

</script>

I got it working using the code above i hope it is help to other persons.