jquery version
Copy Code code as follows:
$.ajax ({
URL: "Order/order_orderdetail.do?params.type=merge",
Type: "Post",
Data:params,
Success:function (XML) {
Hide ();
if (xml = = "") {
Dialog.poptip ("Cannot find the order to be merged", 2);
}else{
var Mytable=document.getelementbyid ("T_product");
Traverse the "Order" node
$ (XML). Find ("Order"). each (function () {
var id = $ (this). Find ("ORDERID"). Text ();
var status = $ (this). Find ("status"). Text ();
if (Status = = "1") {
Status= "not confirmed";
}else{
Status= "confirmed";
}
var newrow = Mytable.insertrow ();
var Ocell = Newrow.insertcell ();
Ocell.setattribute ("Height", "25");
Ocell.innerhtml= "";
Ocell = Newrow.insertcell ();
Ocell.innerhtml= "*<b> order <span style=\" color:red\ ">" +id+ "</span> status is: <span style=\" color:red\ ">" +status+ "</span></b>, the goods are as follows <input type=\" checkbox\ "name=\" Morder\ "value=" +id+ "onclick=\" MergeOrder (); \ ">";
Ocell = Newrow.insertcell ();
Ocell.innerhtml= "";
Ocell = Newrow.insertcell ();
Ocell.innerhtml= "";
Traversing the "PRODUCT" node
$ (this). Find (' PRODUCT '). each (function () {
var pid = $ (this). Find ("PRODUCTID"). Text ();
var pname = $ (this). Find ("PRODUCTNAME"). Text ();
var purl = $ (this). Find ("Producturl"). Text ();
var Pprice = $ (this). Find ("price"). Text ();
var Pcount = $ (this). Find ("Goodscount"). Text ();
NewRow = Mytable.insertrow ();
Ocell = Newrow.insertcell ();
Ocell.setattribute ("Height", "25");
Ocell.innerhtml=pid;
Ocell = Newrow.insertcell ();
Ocell.innerhtml= "<a href=\" "+purl+" \ "target=\" _blank\ ">" +pname+ "</a>";
Ocell = Newrow.insertcell ();
Ocell.innerhtml= "<input Style=\ "width:20px; border:0; Text-align:center;\ "type=\" text\ "id=\" P "+pid+" \ "name=\" order.count\ "class=\" txt\ "value=" +pcount+ "readonly/> Ocell = Newrow.insertcell ();
Ocell.innerhtml=pprice;
});
});
}
},
Error:function () {
Hide ();
Dialog.poptip ("Server Busy", 2);
}
});
JS version
Copy Code code as follows:
if (Xmlhttp.readystate ==4) {
if (Xmlhttp.status ==200) {
Hide ();
var xml = Xmlhttp.responsexml;
if (XML = = null) {
Dialog.poptip ("Cannot find the order to be merged", 2);
}else{
var Mytable=document.getelementbyid ("T_product");
var orders = Xml.getelementsbytagname ("Order");
for (Var i=0;i<orders.length;i++) {
var order = Orders[i];
var id = order.getelementsbytagname ("ORDERID") [0].childnodes[0].nodevalue;
var status =order.getelementsbytagname ("status") [0].childnodes[0].nodevalue;
alert (status);
if (Status = = "1") {
Status= "not confirmed";
}else{
Status= "confirmed";
}
var newrow = Mytable.insertrow ();
var Ocell = Newrow.insertcell ();
Ocell.setattribute ("Height", "25");
Ocell.innerhtml= "";
Ocell = Newrow.insertcell ();
Ocell.innerhtml= "*<b> order <span style=\" color:red\ ">" +id+ "</span> status is: <span style=\" color:red\ ">" +status+ "</span></b>, the goods are as follows <input type=\" checkbox\ "name=\" Morder\ "value=" +id+ "onclick=\" MergeOrder (); \ ">";
Ocell = Newrow.insertcell ();
Ocell.innerhtml= "";
Ocell = Newrow.insertcell ();
Ocell.innerhtml= "";
var products = Order.getelementsbytagname ("PRODUCT");
for (Var i=0;i<orders.length;i++) {
var product = Products[i];
var pid = product.getelementsbytagname ("PRODUCTID") [0].childnodes[0].nodevalue;
var pname = product.getelementsbytagname ("PRODUCTNAME") [0].childnodes[0].nodevalue;
var purl = product.getelementsbytagname ("Producturl") [0].childnodes[0].nodevalue;
var pprice = product.getelementsbytagname ("Price") [0].childnodes[0].nodevalue;
var pcount = product.getelementsbytagname ("Goodscount") [0].childnodes[0].nodevalue;
NewRow = Mytable.insertrow ();
Ocell = Newrow.insertcell ();
Ocell.setattribute ("Height", "25");
Ocell.innerhtml=pid;
Ocell = Newrow.insertcell ();
Ocell.innerhtml= "<a href=\" "+purl+" \ "target=\" _blank\ ">" +pname+ "</a>";
Ocell = Newrow.insertcell ();
Ocell.innerhtml= "<input Style=\ "width:20px; border:0; Text-align:center;\ "type=\" text\ "id=\" P "+pid+" \ "name=\" order.count\ "class=\" txt\ "value=" +pcount+ "readonly/> Ocell = Newrow.insertcell ();
Ocell.innerhtml=pprice;
}
}
}
}
}