$(document).ready(function(){
$(".orderClass").click(function(){
var orderId=$(this).text();
$.ajax({
type:"post",
url:"ShowOrderDetails.aspx?orderId="+orderId,//转向一个后台处理页面
success:function(msg){ //ajax成功时候的处理
var objs=msg.split(";");
$(".divClass:eq("+index+")").html("
- 商品名称</span>购买数量</span>商品单价</span>所属商铺</span></li></ul>").hide();
for(var i=0;i{
var objArray=objs[i].split(",");
var name=objArray[0];
var number=objArray[1];
var price=objArray[2];
var shopName=objArray[3];
var pid=objArray[4];
$(".divClass").hide();
$(".divClass:eq("+index+")").append("- "+name+"</a></span>"+
number+"</span>"+price+"</span>"+shopName+"</span></li>").show(500);
}
},
error:function(msg)
{
}
});
});
ShowOrderDetails.aspx.cs 处理JS的后台代码
Tb_TgOrderDetailsBLL orderDetails = new Tb_TgOrderDetailsBLL();
Tb_TgShopBLL shop = new Tb_TgShopBLL();
protected void Page_Load(object sender, EventArgs e)
{
if (Request.QueryString["orderId"] == null)
{
Response.Write("");
Response.End();
}
string orderId = Request.QueryString["orderId"];
StringBuilder builder = new StringBuilder("");
foreach (DataRow row in orderDetails.GetDetailsByOderId(orderId).Rows)
{
string productName = row["p_name"].ToString(); //商品名称
string number = row["details_number"].ToString(); //购买数量
string price = row["p_price"].ToString(); //团购价格
string shopId = row["p_shop_id"].ToString();
string pid=row["p_id"].ToString();
string shopName = shop.GetShopById(shopId)["shop_name"].ToString(); //所属商铺
builder.AppendFormat("{0},{1},{2},{3},{4};", productName, number, price, shopName, pid);
}
Response.Write(builder.ToString());
Response.End(); - "+name+"</a></span>"+