The load method in jquery loads data from the server and places the returned data into the specified element. Its usage syntax is "$(selector).load(url,data,function(response,status,xhr) ))”.
The operating environment of this article: windows7 system, jquery version 3.2.1, DELL G3 computer
What does load mean in jquery?
The jquery load() method loads data from the server and places the returned data into the specified element.
Note: There is also a jQuery event method called load. Which one is called depends on the parameters.
Syntax
$(selector).load(url,data,function(response,status,xhr))
Parameters
url required. Specify the URL you need to load.
data Optional. Specifies the data to be sent to the server with the request.
function(response,status,xhr) Optional. Specifies the callback function to be run when the load() method completes.
Extra parameters:
response - Contains the result data from the request
status - Contains the status of the request ("success", "notmodified", "error", " timeout", "parsererror")
xhr - Contains the XMLHttpRequest object
Instance
Load the contents of the file "demo_test.txt" into the specified
$("button").click(function(){ $("#div1").load("demo_test.txt"); });
Recommended learning: "jquery video tutorial"
The above is the detailed content of What does load mean in jquery?. For more information, please follow other related articles on the PHP Chinese website!