我在互联网上找到了这段代码,我需要 ajax 代码来发布$row[ID]
到我的delete.php
文件:
echo "<td><a id=$row[ID] onclick=\"if(confirm('Are you sure you want to delete this?')) deleteRow(this.parentNode.parentNode.rowIndex); return false; \" href=\"\" >del</A> </td>"
我努力了:
function deleteRow(i){
var makarios = document.getElementById('m').deleteRow(i)
var mak;
if (window.XMLHttpRequest) {
// Mozilla, Safari, ...
mak = new XMLHttpRequest();
} else if (window.ActiveXObject) {
// IE 8 and older
mak = new ActiveXObject("Microsoft.XMLHTTP");
}
var data = "id=" + makarios;
mak.open("POST", "delete_basket.php", true);
mak.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
mak.send(data);
}