Answers for "how to prevent ajax from call twice"

1

how to prevent ajax from call twice

$(element).off('click').on('click', function() {
    // function body
});
Posted by: Guest on September-25-2021
1

how to prevent ajax from call twice

$(element).off().on('click', function() {
    // function body
});
Posted by: Guest on September-25-2021
0

Prevent an ajax request firing twice with jQuery

var ajaxLoading = false;
$(document).ready(function() {
    $('#ajaxRequestor').click(function(e) {
        e.preventDefault();
        if(!ajaxLoading) {
            ajaxLoading = true;
            $('#ajaxContentPlaceholder').load('/path/to/content.html', 
                function() { 
                    ajaxLoading = false;
                }
            );
        }
    });
});
Posted by: Guest on April-04-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language