reload html table data after database entry deleted

前端 未结 1 533
暗喜
暗喜 2021-01-29 05:55

I am building a web page using asp classic and populating a mdb into an html with delete button at the end of each row. When the delete button is clicked the database entry is b

1条回答
  •  野的像风
    2021-01-29 06:34

    Probably the easiest way would be to give each an id based on the id of the current record then use JavaScript to post to the delete routine (which will be held in a separate ASP file), then hide the row by changing the style.display.

    >
        ...
        ...
        
            );"
        
    
    

    And the JavaScript could be something like...

    var xmlhttp;
    if (window.XMLHttpRequest) xmlhttp=new XMLHttpRequest();    // code for IE7+, Firefox, Chrome, Opera, Safari...
    else xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");      // code for IE6, IE5
    
    function ajaxPage(postPage, paramList) {xmlhttp.open("POST",postPage,false);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.send(paramList);return xmlhttp.responseText;}
    
    function deleteRow(id) {
        ajaxPage("deleteFunctionPage.asp", "id=" + id);
        document.getElementById("row" + id).style.display = "none";
    }
    

    0 讨论(0)
提交回复
热议问题