javascript ajax 传递二维数组
functioncart_edit(){varrec_id_arr=newArray();vartext=document.getElementById("formCar...
function cart_edit(){
var rec_id_arr=new Array();
var text=document.getElementById("formCart").getElementsByTagName("input");
var total_price=0;
for(var i=0;i<text.length;i++){
if(text[i].type=="text"){
rec_id_arr[text[i].id.replace("goods_number_","")]=new Array();
rec_id_arr[text[i].id.replace("goods_number_","")]["number"]=document.getElementById("goods_number_"+text[i].id.replace("goods_number_","")).value;
rec_id_arr[text[i].id.replace("goods_number_","")]["price"]=document.getElementById("price_val_"+text[i].id.replace("goods_number_","")).value;
}
}
alert(rec_id_arr.toString());
Ajax.call('../ajax/cart.php', 'goods=' + rec_id_arr, hrefgo, 'POST', 'JSON');
}
rec_id_arr. 如何写才能传递给php 展开
var rec_id_arr=new Array();
var text=document.getElementById("formCart").getElementsByTagName("input");
var total_price=0;
for(var i=0;i<text.length;i++){
if(text[i].type=="text"){
rec_id_arr[text[i].id.replace("goods_number_","")]=new Array();
rec_id_arr[text[i].id.replace("goods_number_","")]["number"]=document.getElementById("goods_number_"+text[i].id.replace("goods_number_","")).value;
rec_id_arr[text[i].id.replace("goods_number_","")]["price"]=document.getElementById("price_val_"+text[i].id.replace("goods_number_","")).value;
}
}
alert(rec_id_arr.toString());
Ajax.call('../ajax/cart.php', 'goods=' + rec_id_arr, hrefgo, 'POST', 'JSON');
}
rec_id_arr. 如何写才能传递给php 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询