jquery當(dāng)中Ajax的基礎(chǔ)原理是什么



例 3.1(AjaxPrerequ1.html)
馬克- to-win:馬克 java社區(qū):防盜版實(shí)名手機(jī)尾號(hào): 73203。
<html>
<head>
<script>
/* 馬克-to-win:這個(gè)例子和jquery沒任何關(guān)系。就是自己如何從頭做一個(gè)jquery。the following
is a json format, which can have a function as a pair. */
var $={
    name:'馬克-to-win',
    getById:function(obj){

        return document.getElementById(obj);

    },
    set:function(){
    /*下面的$可以換成this,結(jié)果是一樣的*/
        $.getById('show').innerHTML = "哈蘇大蘇打靠近哈快速地結(jié)合看 "+this.name;
  
    }

}
</script>

</head>

<body>
<input type="button" value="提交" onclick="$.set()" />

<div id="show"></div>
</body>

</html>





例 3.2(AjaxPrerequ2.html)


<html>
<head>
<script>

var $=function(obj){
    var email =   document.getElementById(obj).innerHTML;
    alert(email);
}

</script>

</head>

<body>

<input type="button" value="獲取" onclick="$('email')" />

<div id="show"></div>
<div id="email">wanghaiquan@hotmail.com</div>
</body>

</html>







例 3.3(AjaxPrerequ2o.html)




<html>
<head>
<script>
var Jquery={
    getByID:function(obj){
        return document.getElementById(obj);
    },
    $:function(obj){
/*下面的Jquery可以換成this,結(jié)果是一樣的*/
        var email =   Jquery.getByID(obj).innerHTML;
            alert(email);
    }
}

</script>

</head>

<body>
<input type="button" value="獲取" onclick="Jquery.$('email')" />

<div id="show"></div>
<div id="email">wanghaiquan@hotmail.com</div>
</body>

</html>






例 3.4(AjaxPrerequ3.html)




<html>
<head>
<script>
/* the following is a json format, which can have a function as a pair. */
var $1={
    'name':'qixy',
    getById:function(obj){
        return document.getElementById(obj);
    },
        setshow:function(){
                $1.getById('show').innerHTML = "馬克-to-win:哈蘇大蘇打靠近哈快速地結(jié)合看 "+this.name;
        },
    setbyP:function(objn){
                this.name=objn;
        return this;
    }

}
var $=function(obj){
    return $1.setbyP(obj);
}
</script>
</head>
<body>

<input type="button" value="提交constructor" onclick="$('mark').setshow()" />

<div id="show"></div>
</body>

</html>