<!DOCTYPE?html?PUBLIC?"-//W3C//DTD?XHTML?1.0?Transitional//EN"?"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html?xmlns="http://www.w3.org/1999/xhtml">
????<head>
????????<title>使用load()方法異步請求數(shù)據(jù)</title>
????????<script?src="http://libs.baidu.com/jquery/1.9.0/jquery.js"?type="text/javascript"></script>
????????<link?href="style.css"?rel="stylesheet"?type="text/css"?/>
????</head>
????
????<body>
????????<div?id="divtest">
????????????<div?class="title">
????????????????<span?class="fl">我最愛吃的水果</span>?
????????????????<span?class="fr">
????????????????????<input?id="btnShow"?type="button"?value="加載"?/>
????????????????</span>
????????????</div>
????????????<ul></ul>
????????</div>
????????
????????<script?type="text/javascript">
????????????$(function?()?{
????????????????$("#btnShow").bind("click",?function?()?{
????????????????????var?$this?=?$(this);
????????????????????$("ul")
????????????????????.html("<img?src='Images/Loading.gif'?alt=''/>")
????????????????????.load("?http://idcbgp.cn/data/fruit_part.html",function(){
????????????????????????
????????????????????????$this.attr("disabled",?"true");
????????????????????});
????????????????})
????????????});
????????</script>
????</body>
</html>
2016-04-03
.load("?http://idcbgp.cn/data/fruit_part.html",function(){
http前面的空格去掉 ?嗯 就是這么簡單
另外:正確的應(yīng)該是:http://idcbgp.cn/data/fruit_part.html?li ? 只顯示里面的li標(biāo)簽的內(nèi)容.
然后 ?教程的通病 ?disable:ture ? ?true 是不用加引號的 ? 加了引號 ?效果也一樣 ?但是!!!: ? "true" 和 ?"flase" 效果也一樣,因為""字符串轉(zhuǎn)布爾類型用真 ?不信你試試 ?$this.attr("disabled",?"false"); ? 一樣按鈕不可用
2016-04-04
?http://idcbgp.cn/data/fruit_part.html前面多了個——空格!
2016-04-02
把true的雙引號去掉試試