Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

complete ajax request jquery php call | ajax request

<script type="text/javascript">
    function ajaxCall(formID, showID) {
        var form = $('#' + formID);
        $.ajax({
            type: form.attr('method'),
            url: form.attr('action'),
            data: form.serialize(),
            dataType: "JSON",
            cache: false,
            success: function (data, status, xhr) {
                $('#' + showID).html('').fadeOut('fast');
                $('#' + showID).html(data).fadeIn('slow');
            },
            error: function (xhr, status, error) {
                //alert(xhr);
                console.error(xhr);
            }
        });
    }
</script>
 
PREVIOUS NEXT
Tagged: #complete #ajax #request #jquery #php #call #ajax #request
ADD COMMENT
Topic
Name
3+2 =