我现在只是想要我的页面的部分数据刷新之后提交到数据库,但是其他数据不动,应该是用ajax吧!我不太懂这一块,那个大侠教教我啊,大概告诉我用什么技术也行,但是具体用到什么函数的可以提点一下不啊,我这一块不是很熟,十分感谢!

解决方案 »

  1.   

    <html>
    <head>
    <script type="text/javascript">
    function loadXMLDoc()
    {
    var xmlhttp;
    if (window.XMLHttpRequest)
      {// code for IE7+, Firefox, Chrome, Opera, Safari
      xmlhttp=new XMLHttpRequest();
      }
    else
      {// code for IE6, IE5
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    xmlhttp.onreadystatechange=function()
     {
      if (xmlhttp.readyState==4 && xmlhttp.status==200)
      {
      document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
      }
      }
    xmlhttp.open("GET","1.asp",true);
    xmlhttp.send();
    }
    </script>
    </head>
    <body>
    <h2>AJAX</h2>
    <button type="button" onclick="loadXMLDoc()">请求数据</button>
    <div id="myDiv"></div>
    </body>
    </html>
      

  2.   

    <html>
    <head>
    <script type="text/javascript">
    function loadXMLDoc(){
    var xhr;
    if (window.XMLHttpRequest){  // code for IE7+, Firefox, Chrome, Opera, Safari
      xhr=new XMLHttpRequest();
      }
    else if{     // code for IE6, IE5
      xhr=new ActiveXObject("Microsoft.XMLHTTP");
      }
    xhr.onreadystatechange=function(){
      if (xhr.readyState==4 && xhr.status==200){ //Loading Over & Ready for it
      document.getElementById("myDiv").innerHTML=xhr.responseText;
      }
      }
    xhr.open("GET","//URL",true);//as Method - URL - True or False
    xhr.send(null);
    }
    </script>
    </head>
    <body>
    <h2>It`s AJAX</h2>
    <button type="button" onclick="loadXMLDoc()">请求数据</button>
    <div id="myDiv"></div>
    </body>
    </html>