Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #alert #ajax
ADD COMMENT
Topic
Name
4+9 =