Jquery 常用的代码---form ,ajax ,拼接表格

var path = '${pageContext.request.contextPath}/order/exportSale';
$('#form').attr("action", path).submit();

----------jquery Form 提交


$.ajax({
url:'${pageContext.request.contextPath}/order/editSku-json',
type:'post',
data:{"id":id,"sku":newsku},
async : false, //默认为true 异步
error:function(){
alert('ajax error');
},
success:function(data){
var jsondata = eval("("+data+")");
if(!jsondata.result){
alert(jsondata.error);
return;
}
--window.location.reload();
}
});


---------------Ajax 提交


//批量操作
function test(){
var s ="";
$('#list_table [type="checkbox"]:checked').each(function(){
s+=$(this).val()+',';
});

var idList = s.substring(0, s.length-1);
$.post('${contextPath }/order-package/back',
{idList : idList},
function(){
window.location.href="${contextPath }/order-package";
});
}
-------------------获取 ID 进行批量操作


function format(d){

var html = '<table>'
+ '<tr><th>名称</th><th>SKU</th><th>订单数量</th>'
+ '<th>包裹数量</th><th>出货数量</th><th>单价</th><th>包装规格</th>'
+ '<th>仓库</th></tr>'

$.ajax({
type : "post",
async: false,
url : "${contextPath }/order-package/packageItem",
data : {
id : d.id,
},
success : function(data) {

$.each(data, function(commentIndex, comment){
html += '<tr><th>'+comment.goodsName+'</th><th>'+comment.sku+'</th>
<th>'+comment.orderAmount+'</th>'+'<th>'+comment.packageAmount+'</th> <th>'+comment.shipmentAmount+'</th><th>'+comment.price+'</th> <th>'+comment.specifications+'</th>'+<th>'+comment.storeName+'</th></tr>'
});

html += '</table>';
}
});

return html;
}

-----------返回data数据 拼接html 展示数据
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值