jquery当中Ajax的基础原理是什么



例 3.1(AjaxPrerequ1.html)
马克- to-win:马克 java社区:防盗版实名手机尾号: 73203。
<html>
<head>
<script>
/* 马克-to-win:这个例子和jquery没任何关系。就是自己如何从头做一个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,结果是一样的*/
        $.getById('show').innerHTML = "哈苏大苏打靠近哈快速地结合看 "+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,结果是一样的*/
        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:哈苏大苏打靠近哈快速地结合看 "+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>