Ajax
English [?e?e?d??ks] US [?e?d??ks]
n. ?? ??? "Asynchronous JavaScript and XML"(??? JavaScript ? XML)???. ; Ajax ??-??-? ??? ??, Yajis ???
errors
n. ??(??? ?? ??);
??? ajaxError() ??? ???
Function: ajaxError() ???? AJAX ??? ??? ??? ? ??? ?????. ??? ??????.
??: ??.ajaxError(function(event,xhr,options,exc))
????:
Parameters | Description |
function(event,xhr, ????) | ?????. ??? ??? ? ??? ??? ?????. ?? ????: event - ??? ??? ?????. xhr - XMLHttpRequest ??? ?????. options - AJAX ??? ???? ??? ?????. ex - JavaScript ??? ?????. |
??: XMLHttpRequest ?? ? ??? ?? ??? ?? ??? ?????. ??? ??? ??? ????? ??? ? ????: function (event, XMLHttpRequest, ajaxOptions, throwError) {// ThrowError? ??? ??? ?? ?????.}
??? ajaxError() ??? ?
<html> <head> <script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("div").ajaxError(function(){ alert("發(fā)生錯誤!"); }); $("button").click(function(){ $("h2").text("文本已經改變"); }); }); </script> </head> <body> <div id="txt"><h2>通過 AJAX 改變文本</h2></div> <button>改變內容</button> </body> </html>
??? ????? ??? "???? ??" ??? ?????