Answers for "get alert after using ajax"

0

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>
Posted by: Guest on September-23-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language