jQuery的load()方法及其回调函数用法示例
本文实例讲述了jQuery的load()方法及其回调函数用法。分享给大家供大家参考。具体如下:
下面的js代码演示了jQuery的load()方法的`使用,并演示了带回调函数(callback)的load方法的使用
$(document).ready(function(){ $("button").click(function(){ $("#div1").load("demo_test.txt",function(responseTxt,statusTxt,xhr){ if(statusTxt=="success") alert("External content loaded successfully!"); if(statusTxt=="error") alert("Error: "+xhr.status+": "+xhr.statusText); }); });});
Let jQuery AJAX Change This Text
Get External Content