php echo "success";//if success javascript if(data=="success") { window.location.href = "target.html" else { $('#form-messages").html(data) }