8

Is it better to use

$.get("http://www.example.com/mydirectory", function(data) {
        $(".someclass").html(data);
});

or

$('.tripPlannerBottom').load("http://www.example.com/mydirectory");

any speed or performance benefits?

2 Answers 2

12

I have no benchmark data to back my claim up, but by looking at the source, $.get + html() and .load() are basically the same. .load() is a convenience wrapper around .get() + html()

Sign up to request clarification or add additional context in comments.

1 Comment

So as its a coding benefit :)
9

.load, .get & .post are wrappers around the .ajax method. There is no performance boost apart from few chars you save in typing without having to create the settings if using the .ajax method.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.