Bạn có muốn phản ứng với tin nhắn này? Vui lòng đăng ký diễn đàn trong một vài cú nhấp chuột hoặc đăng nhập để tiếp tục.

Latest topics

» [sare] Trang chủ bảo trì.
by bnlock567 Thu Jul 18, 2019 1:10 pm

» Chia Sẻ Trang Chủ HTML - 3 Cái
by bnlock567 Thu Jul 18, 2019 1:06 pm

» Một số template dùng để làm trang ch
by bnlock567 Thu Jul 18, 2019 1:05 pm

» [Sare ] 1 trang chủ cũng BT
by bnlock567 Thu Jul 18, 2019 11:53 am

» [ FM ] Bảng thông báo đẹp
by bnlock567 Tue Jul 16, 2019 11:36 am

» "Bảng nổi" trog FM
by bnlock567 Tue Jul 16, 2019 11:31 am

» Chuyển Host upload ảnh
by dang02315 Fri Sep 02, 2016 12:32 am

» [ AUTO 2U ] PHIÊN BẢN 2.5.3 ( MỚI NHẤT )
by ngothithuyva Mon Sep 14, 2015 9:14 am

» [ AUTO 2U ] PHẦN MỀM BN2U - AUTO 2U MỚI NHẤT
by Xop Paseo Wed Sep 09, 2015 9:58 am

» [ AUTO 2U ] PHIÊN BẢN 2.5.2-NGÀY 24/10/2014
by chebienk5a Tue Sep 08, 2015 9:52 pm

» [ AUTO ] Tự nhảy game 2U
by chebienk5a Tue Sep 08, 2015 7:36 pm

» [ Bách chiến vô song 2 ] Cách đi phó bản ma giáo đàn 6-7 boss
by Admiin Mon Aug 24, 2015 5:40 pm

» [ LIST KEY 2U ] NGÀY 29/6/2015 PHIÊN BẢN 2.5.2 Trở Lên
by Pé Pun Sun Aug 23, 2015 5:01 pm

» [ AUTO 2U ] Demo auto up thân mật pet ver 1.0
by steven.gia119 Sun Aug 16, 2015 8:11 pm

» [ KEY Bảng Vàng ] NGÀY 05/03/2015 - ( Lần 3 )
by steven.gia119 Sun Aug 16, 2015 8:10 pm

» [ LIST KEY 2U ] NGÀY 24/10/2014 PHIÊN BẢN 2.5.1 Trở Lên
by chepchep800 Fri Aug 07, 2015 12:14 pm

» [ LIST KEY 2U ] NGÀY 18/2/2015 PHIÊN BẢN 2.5.2 Trở Lên
by chepchep800 Thu Aug 06, 2015 9:28 pm

» [ AUTO 2U ] Auto UP EXP UP vũ đạo Ver 2.5.3
by akikaneko Mon Jul 13, 2015 8:03 pm

» [ AUTO 2U ] PHIÊN BẢN 2.5.1 - NGÀY 15/9/2014
by ohellobeyeu Mon Jul 06, 2015 9:32 pm

» [ AUTO 2U ] UPDATE AUTO MỚI
by Admiin Sun Jul 05, 2015 4:35 pm

» Công thức ép chậu Khu vườn trên mây
by khanhkute Sat Jul 04, 2015 2:57 pm


    Javascript Simple Ajax Class

    admin
    admin
    Admin
    Admin


    Posts Posts : 449
    Points Points : 12550
    Thanked Thanked : 29
    Tham Gia Tham Gia : 02/10/2010
    Tuổi Tuổi : 30
    Đến từ Đến từ : Nơi Bình yên Không có nhữg kẻ Lừa đảo cạnh bên

      
     :

    Javascript Simple Ajax Class Empty Javascript Simple Ajax Class

    Bài gửi by admin Sat Oct 02, 2010 12:54 pm

    Javascript Simple Ajax Class
    funcion.js

    var AJAX_Handler = function()
    {
    this.xmlHttp = false;
    try{
    this.xmlHttp = new XMLHttpRequest();
    }catch(e){
    try{
    this.xmlHttp = new ActiveXObject('Microsoft.XMLHTTP');
    }catch(e){
    try{
    this.xmlHttp = new ActiveXObject('Msxml2.XMLHTTP');
    }catch(e){
    alert('Your browser does not support AJAX');
    return;
    }
    }
    }

    this.onreadystatechange = function(updateFunc){
    this.updateFunc = updateFunc;
    }

    this.send = function(url,param){
    param = param ? param : "";
    this.xmlHttp.onreadystatechange = this.updateFunc;
    this.xmlHttp.open("POST", url, true);
    this.xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    this.xmlHttp.setRequestHeader("Content-length", param.length);
    this.xmlHttp.setRequestHeader("Connection", "close");
    this.xmlHttp.send(encodeURI(param));
    this.handler = this.xmlHttp;
    }
    }

    b.php

    <?

    if($_GET['tab'] == 2){
    echo 'tab 21';
    }
    elseif($_GET['tab'] == 3){
    echo 'tab 3';
    }
    else
    {
    ?>

    <!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>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Test</title>
    <script src="function.js"></script>

    <script>

    function Send(value)
    {
    var ajax = new AJAX_Handler();
    ajax.onreadystatechange(act_done);
    ajax.send("b.php?tab="+value);

    function act_done()
    {
    if(ajax.handler.readyState == 4 && ajax.handler.status == 200){
    document.getElementById('show').innerHTML = ajax.handler.responseText;
    }
    }
    }






    </script>
    </head>

    <body>
    <a href="#" onclick="Send(2)">Tab 2</a>
    <br />
    <a href="#" onclick="Send(3)">Tab 3</a>
    <div id="show"></div>

    </body>
    </html>
    <? }?>






    http://www.mediafire.com/?0lxjiw86x9pplk9

      Hôm nay: Thu Mar 28, 2024 8:16 pm