load
English [l??d]
n.Load; ????; ???, ???
vi .?? ?
;??? ??() ??? ???
??: load() ???? AJAX ??? ?? ???? ???? ???? ??? ???? ??? ??? ?????. load ?? jQuery ??? ???? ????. ?? ?? ?????? ????? ?? ????.
??: ??load(url,data,function(response,status,xhr))
????:
Parameters | Description |
url | ??? ?? URL? ??????. |
??? | ????. ??? ?? ??? ??? ???? ?????. |
??(??,??,xhr) | ????. ??? ???? ??? ??? ?????. ?? ????: response - ??? ?? ???? ?????. status - ?? ??("??", "notmodified", "error", "timeout" ?? "parsererror")? ?????. xhr - XMLHttpRequest ??? ?????. |
??: ? ??? ???? ???? ???? ?? ??? ?????. ?? ??? ??? ??? ?? ??? ??? ?? ???? $.get(url, data, Success) ? ?? ?????. ???? ??? ????(?: textStatus? "success" ?? "notmodified"? ??) .load()? ???? ??? HTML ???? ??? ???? ?????. ?? ? ???? ???? ??? ??? ?? ????? ?? ?????: $("#result").load("ajax/test.html"); ?? ??? ???? ??? ?? ?????. ("#result").load("ajax/test.html", function() {alert("Load was done.");});?? ? ??? ?? ??? "result"? ???? ?? ?? ?? " ID ? ?? .load() ???? ???? ????. ??? ???? ??? ?? POST ???? ????, ??? ??? GET ???? ?????.
??? ??() ??? ?
<!DOCTYPE html> <html> <head> <script src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"> </script> <script> $(document).ready(function(){ $("#btn1").click(function(){ $('#test').load('需要加載的文檔地址'); }) }) </script> </head> <body> <h3 id="test">請點擊下面的按鈕,通過 jQuery AJAX 改變這段文本。</h3> <button id="btn1" type="button">獲得外部的內(nèi)容</button> </body> </html>