jQuery API | jQuery API 中英文对照版 - jQuery在线查询手册 |
load(url, params, callback) |
load(url, params, callback)
装入一个远程HTML内容到一个DOM结点。 注意:避免用装入的scripts脚本,装入脚本改用$.getScript.当任何字符显示时,IE会忽略所有的脚本。 返回值:jQuery 参数:
示例: $("#feeds").load("feeds.html"); HTML 代码: <div id="feeds"></div> 结果: <div id="feeds"><b>45</b> feeds found.</div> 示例: 和上面相似,但加入了当数据装入后执行一个回调函数参数。 $("#feeds").load("feeds.html", {limit: 25}, function() { alert("The last 25 entries in the feed have been loaded"); } ); Load HTML from a remote file and inject it into the DOM. Note: Avoid using this to load scripts, instead use $.getScript. IE strips script tags when there aren't any other characters in front of it. Return value: jQuery
Example: $("#feeds").load("feeds.html");Before: <div id="feeds"></div>Result: <div id="feeds"><b>45</b> feeds found.</div> Example: Same as above, but with an additional parameter and a callback that is executed when the data was loaded. $("#feeds").load("feeds.html", {limit: 25}, function() { alert("The last 25 entries in the feed have been loaded"); } ); |