繁体   English   中英

无需重新加载即可刷新Ajax页面使内容翻倍

[英]Ajax refreshing page without reloading doubles the content

这是我使用的ajax代码,每次单击表中的一行时都会调用它。

function loadPage() {
        var xhttp = new XMLHttpRequest();
        xhttp.onreadystatechange = function() {
             if (xhttp.readyState == 4 && xhttp.status == 200) {
               document.getElementById("view").innerHTML=xhttp.responseText;
              }
        };
        xhttp.open("GET", "userTable.php", true);
        xhttp.send();         
    }

每当我单击所需的每一行时,数据都会更改。 但是,当我单击一行时,页面内容(文本字段,表格,按钮等)就会加倍。 请帮我解决这个问题。 谢谢。

我修好了它。

  $.ajax({
        type: "GET",
        url: "userTable.php?selEmp="+value,

        success: function (response) {

        $("#userBody").html(response);
        setInformation();

        }
});

这是我用的,而不是另一个:)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM