1、$("...").load(url, data, function(response, status, xhr))
参数:
url: 规定要将请求发送到哪个 URL。
data: 可选。规定连同请求发送到服务器的数据。
function(response,status,xhr): 可选。规定当请求完成时运行的函数。
额外的参数: response - 包含来自请求的结果数据
status - 包含请求的状态("success", "notmodified", "error", "timeout" 或 "parsererror")
xhr - 包含 XMLHttpRequest 对象
例子:
$("#result").load("ajax/test.html"); $("#result").load("ajax/test.html", function() { alert("Load was performed."); }); $("#result").load("ajax/test.html #container");//(加载代码片段)