xhr = new XMLHttpRequest();
xhr.open("get","01list.ashx",true)
xhr.setRequestHeader("If-Modeified-Since",0);
xhr.onreadystatechange = function () {
if (xhr.readyState == 4 && xhr.status == 200) {
var res= xhr.responseText;
var jssArr = eval(res);//将回复过来的集合转换为数组
makeTable(jssArr);
"<a href='javascript:void(0)' aid='" + jssclass.Id + "'>删</a>
function del(obj)
{
var delid= obj.getAttribute("aid");
xhr = new XMLHttpRequest();
xhr.open("post","02del.ashx",true)
// xhr.setRequestHeader("If-Modeified-Since",0);
xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
xhr.onreadystatechange = function () {
if (xhr.readyState == 4 && xhr.status == 200) {
if (xhr.responseText == "ok") {
alert("删除成功");
var tr = obj.parentNode.parentNode;
tr.parentNode.removeChild(tr);
}
else {
alert("删除失败");
}
}
};
xhr.send("delid=" + delid);//send用法
alert(delid);
}
原文链接:https://www.f2er.com/ajax/163837.html