user967451
user967451

Reputation:

Basic jQuery AJAX performance Inquiry

When doing ajax requests using jQuery's ajax() function I never use any parameters other than "data" in the success callback:

$.ajax({
    url: 'script.php',
    type: 'post',
    data: $(this).serialize(),
    dataType: 'json',
    success: function(data) {
        alert(data);
    }, 
    error: function(jqXHR, textStatus, errorThrown) {
        console.log(jqXHR);
    }
});

But I was wondering if keeping the other 2 parameters (textStatus, jqXHR) in that function will have any performance impact:

success: function(data, textStatus, jqXHR) {
    alert(data);
} 

I am not doing anything with "textStatus" and "jqXHR", but if I kept them there will there be any performance decrease (even a little)?

Upvotes: 2

Views: 121

Answers (1)

Bojangles
Bojangles

Reputation: 101543

Maybe a little bit, but nothing noticeable considering you're not referencing them - no memory lookups will have to be performed.

If you're doing millions of AJAX calls a second, you might see a delay, but how on Earth you can do a million AJAX requests a second I don't know.

Upvotes: 1

Related Questions