I was browsing through the jQuery api and noticed that the load method is on the deprecated list.
Categories: Deprecated | Events > Document Loading
I usually use this method to check if images are completly loaded. Why is it deprecated? And what am I supposed to be using instead?
Note: the jQuery . load() method was deprecated in jQuery 1.8 and removed completely in jQuery 3.0.
Note: The load() method deprecated in jQuery version 1.8. It was completely removed in version 3.0.
The Load function initializes a database and loads it from an input data file. It can be used for initial loading of a database, as part of a database reorganization, or for reloading a database after changing the DBD definition.
This callback function has three different parameters: parameter 1: It contains the result of the content if the method call succeeds. parameter 2: It contains the status of the call function. parameter 3: It contains the XMLHttpRequest object.
See bug #11733, which documents this deprecation:
The
.load()
method is an ambiguous signature, it can either be an ajax load or attach/fire a "load" event. CCAO cannot tell them apart since it's a dynamic decision based on arguments.
To avoid ambiguities related to the method's signature, it is now recommended to use on() instead. For instance:
$("selector").load(function() { // ... });
Should become:
$("selector").on("load", function() { // ... });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With