Jquery 惯用的代码-form ,ajax ,拼接表格
发布时间:2010-05-20 14:01:29 文章来源:www.iduyao.cn 采编人员:星星草
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 展示数据
友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。
其他相似内容:
-
jQuery搜索框输入文字下拉提示菜单
jQuery搜索框输入文字下拉提示菜单
原文地址:
http://www.jq22.com/jquery-info6193
...
-
7个为开发者准备的有用的jQuery技巧
一、在新窗口打开链接
用下面的代码,你点击链接即可在新窗口打开:
$(document).ready(fu...
-
jQuery获取相应Input例子
页面上有许多input框,使用的是EasyUI样式,中间还参杂着各种其他无id的Input框,如下:
<input class=...
-
webpack 引入jquery和第三方jquery插件
1、引入jquery
jQuery 直接在 html 中引入,然后在 webpack 中把它配置为全局即可。
index....
-
JQuery的开发与使用心得
关于jQuery的
入门使用jQuery可以很容易或具有挑战性的,这取决于你如何使用JavaScript,HTML,CSS进行开发和...
-
深入学习jQuery动画控制
×
目录
[1]动画状态 [2]停止动画 [3]动画延迟[4]全局控制
前面的话
jQuery动画可以使用fade、...
-
jquery操作table表格
一、数据准备
<table id="table1">
<tr><th>文章标题</th><th>文章分类</th><th>发布时间</th><th>...
-
html + css + jquery实现简单的进度条实例
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-eq...
-
jquery中ajax方法的datatype的作用
今天在维护一个项目的时候遇见了一个小问题。但是这个问题我认为对于项目十分有帮助。...
-
jQuery菜单示例(全选,反选,取消)
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta charset="UTF-8">
5 <titl...