限时优惠活动
亲爱的苦力吧用户,我们为了回馈新老用户一直以来的鼎力支持,即日起(2025-02-06至2025-03-06)凡是购买苦力吧VIP/充值K币的新老用户,都直接可获得买一送一的优惠馈赠。例如:购买一个月的VIP会员可直接获得两个月的VIP会员;充值100K币可直接获得200K币,以此类推!有任何疑问可联系在线客服,感谢各位用户对苦力吧素材的信任与厚爱,我们将一如既往的给大家上新更多优质的素材源码,祝大家开工大吉、工作顺利、心想事成。

jquery通过把json数据转换输出为table表格插件

所属分类: 网页特效-实用工具    2023-08-03 10:39:40

jquery通过把json数据转换输出为table表格插件 ie兼容6
 查看演示  登录后下载 温馨提示
登录会员即可享受免费下载
 我要建站

jquery通过把json数据转换输出为table表格插件(共9个文件)

    • index.html

使用方法

		$(document).ready(function() {
			var arr = [
					[1, 2, 3],
					["one", "two", "three"]
			];

      /* Array To Table */
      var input = JSON.stringify(arr);
			$("#jsontotable-arr")
        .append($("

").html("Array To Table")) .append($("

").html("Input")) .append($("").html(input)) .append($("

").html("Output")); $.jsontotable(arr, { id: "#jsontotable-arr", header: true }); /* Array To Table (Without Header) */ $("#jsontotable-arr") .append($("

").html("Array To Table (Without Header)")) .append($("

").html("Input")) .append($("").html(input)) .append($("

").html("Output")); $.jsontotable(arr, { id: "#jsontotable-arr", header: false }); var obj = [ {"Title1": "Hello", "Title2": "Fine", "Title3": "Thank you"}, {"Title1": "안녕하세요", "Title2": "좋아요", "Title3": "감사합니다"}, {"Title1": "こんにちは", "Title2": "ファイン", "Title3": "ありがとう"}, {"Title1": "你好", "Title2": "精", "Title3": "谢谢"}, {"Title1": "Bonjour", "Title2": "Beaux", "Title3": "Merci"}, {"Title1": "Ciao", "Title2": "Bene", "Title3": "Grazie"} ]; /* JSON To Table (Has Header) */ input = JSON.stringify(obj); $("#jsontotable-obj") .append($("

").html("JSON To Table (Has Header)")) .append($("

").html("Input")) .append($("").html(input)) .append($("

").html("Output")); $.jsontotable(obj, { id: "#jsontotable-obj" }); /* JSON To Table (Without Header) */ $("#jsontotable-obj") .append($("

").html("JSON To Table (Without Header)")) .append($("

").html("Input")) .append($("").html(input)) .append($("

").html("Output")); $.jsontotable(obj, { id: "#jsontotable-obj", header: false }); var objmissing = [ {"Title1": "Hello", "Title2": "Fine", "Title3": "Thank you"}, {"Title1": "안녕하세요", "Title2": "좋아요", "Title3": "감사합니다"}, {"Title4": "こんにちは", "Title2": "ファイン", "Title5": "ありがとう"}, {"Title1": "你好", "Title5": "精", "Title3": "谢谢"}, {"Title5": "Bonjour", "Title4": "Beaux", "Title3": "Merci"}, {"Title1": "Ciao", "Title6": "Bene", "Title7": "Grazie"} ]; /* JSON To Table (Has Header and Missing some columns in body */ input = JSON.stringify(objmissing); $("#jsontotable-obj") .append($("

").html("JSON To Table (Has Header and Missing some columns in body)")) .append($("

").html("Input")) .append($("").html(input)) .append($("

").html("Output")); $.jsontotable(objmissing, { id: "#jsontotable-obj" , header: true }); var objwithdata = [ { id: "header", "class": "header-class", _data:{"Title1": "안녕하세요", "Title2": "좋아요", "Title3": "감사합니다"} }, {"Title1": "안녕하세요", "Title2": "좋아요", "Title3": "감사합니다"}, {"Title1": "こんにちは", "Title2": "ファイン", "Title3": "ありがとう"}, {"Title1": "你好", "Title2": "精", "Title3": "谢谢"}, {"Title1": "Bonjour", "Title2": "Beaux", "Title3": "Merci"}, {"Title1": "Ciao", "Title2": "Bene", "Title3": "Grazie"} ]; /* JSON To Table with _data attribute (Has Header) */ input = JSON.stringify(objwithdata); $("#jsontotable-objwithdata") .append($("

").html("JSON To Table with _data attribute (Has Header)")) .append($("

").html("Input")) .append($("").html(input)) .append($("

").html("Output")); $.jsontotable(objwithdata, { id: "#jsontotable-objwithdata" }); /* JSON To Table with _data attribute (Without Header) */ $("#jsontotable-objwithdata") .append($("

").html("JSON To Table with _data attribute (Without Header)")) .append($("

").html("Input")) .append($("").html(input)) .append($("

").html("Output")); $.jsontotable(objwithdata, { id: "#jsontotable-objwithdata", header: false }); var str = "[\ {\"Title1\": \"Hello\", \"Title2\": \"Fine\", \"Title3\": \"Thank you\"}, \ {\"Title1\": \"안녕하세요\", \"Title2\": \"좋아요\", \"Title3\": \"감사합니다\"}, \ {\"Title1\": \"こんにちは\", \"Title2\": \"ファイン\", \"Title3\": \"ありがとう\"}, \ {\"Title1\": \"你好\", \"Title2\": \"精\", \"Title3\": \"谢谢\"}, \ {\"Title1\": \"Bonjour\", \"Title2\": \"Beaux\", \"Title3\": \"Merci\"}, \ {\"Title1\": \"Ciao\", \"Title2\": \"Bene\", \"Title3\": \"Grazie\"} \ ]"; /* JSON (String Format) To Table" */ $("#jsontotable-str") .append($("

").html("JSON (String Format) To Table")) .append($("

").html("Input")) .append($("").html(input)) .append($("

").html("Output")); $.jsontotable(str, { id: "#jsontotable-str", className: "table table-bordered table-striped" }); });

站长提示:
1. 苦力吧素材官方QQ群:950875342
2. 平台上所有素材资源,需注册登录会员方能正常下载。
3. 会员用户积极反馈网站、素材资源BUG或错误问题,每次奖励2K币
4. PHP源码类素材,如需协助安装调试,或你有二次开发需求,可联系苦力吧客服。
5. 付费素材资源,需充值后方能下载,如有任何疑问可直接联系苦力吧客服
相关资源 / 实用工具

jquery支持移动、缩放、倾斜、旋转的图片编辑器

一款在线图片编辑工具,支持图片各种操作:旋转、倾斜、缩放和平移等功能,带可拖动的进度滑块。
  实用工具
 8497  0

纯js创建的待办事项列表实用工具

一款待办实用工具,通过填写标题内容表单添加待办事件,添加的任务可删除。
  实用工具
 2477  0

javascript支持鼠标动态调整DIV大小插件

一款原生js实现的DIV大小插件,通过鼠标拖动div的四个角来更改div大小的功能。向div的resizer元素添加事件监听,让用户交互式的调整div的宽度和高度。
  实用工具
 2201  0

jquery输入的表单内容转换为ASCII字符

一款ASCII字符转换工具,对文本框输入的字符在线转换为ASCII字符,很实用的在线工具。
  实用工具
 4173  0

评论数(0) 回复有机会获得K币 用户协议

^_^ 还没有人评论,快来抢个沙发!
😀
  • 😀
  • 😊
  • 😂
  • 😍
  • 😑
  • 😷
  • 😵
  • 😛
  • 😣
  • 😱
  • 😋
  • 😎
  • 😵
  • 😕
  • 😶
  • 😚
  • 😜
  • 😭
发表评论