🚨 Time is Running Out: Reserve Your Spot in the Lucky Draw & Claim Rewards! START NOW

Code has been added to clipboard!

jQuery .load(): Get to Know This Deprecated Method

Reading time 2 min
Published Jan 8, 2018
Updated Oct 10, 2019

jQuery load: Main Tips

  • The now removed jQuery .load() method attached an event handler to the load event.
  • The load event triggers when an element and all the sub-elements related to it finish loading.
  • You can still use the AJAX .load() method in jQuery. However, despite the same name, it has a different purpose, so don't confuse the two!
  • Easy to use with a learn-by-doing approach
  • Offers quality content
  • Gamified in-browser coding experience
  • The price matches the quality
  • Suitable for learners ranging from beginner to advanced
Main Features
  • Free certificates of completion
  • Focused on data science skills
  • Flexible learning timetable
  • Simplistic design (no unnecessary information)
  • High-quality courses (even the free ones)
  • Variety of features
Main Features
  • Nanodegree programs
  • Suitable for enterprises
  • Paid Certificates of completion
  • Easy to navigate
  • No technical issues
  • Seems to care about its users
Main Features
  • Huge variety of courses
  • 30-day refund policy
  • Free certificates of completion

Usage and Syntax of .load()

The .load() jQuery method attached an event handler that executed a function when the specified element was fully loaded. Using the example below, an alert would have popped up when the page finished loading:

	alert("The window has loaded!");

As you can see, the jQuery .load() function followed rather simple syntax:


Basically, jQuery .load() was a shortcut for using the .on() method with its parameters defined as "load", handler. You can still use this syntax to achieve the same result.

Note: the jQuery .load() method was deprecated in jQuery 1.8 and removed completely in jQuery 3.0.

Don't Get Mixed Up: .load() by AJAX

You cannot use the jQuery .load() method for event handlers now. However, you can use a method with the same name to get data from a server. While the name might add to confusion, this .load() is actually an AJAX method.

Before the event handling .load() method was removed, jQuery chose which of the two to execute based on the defined arguments. The currently unsupported method took just one (function), and the AJAX method takes three (a required URL, plus the optional data and callback).