get alert after using ajax
<script>
$(function () {
$("#myForm").submit(function (evenr) {
event.preventDefault(e);
var form_data = $(this).serialize();
$.ajax({
url:'mail.php',
method:'POST',
data:{data},
success:function(data){
alert(data);
if($.trim(data))
{
alert("Mail was sent !")
$("#success_message").attr("style", "display: none");
}else{ alert("Mail was not sent !")}
}
});
});
});
</script>