Home > php教程 > php手册 > jquery之array,subject转json

jquery之array,subject转json

WBOY
Release: 2016-06-07 11:43:02
Original
1210 people have browsed it

jquery将js 的array,subject数据转为json数据
<script></script><br> <script></script><br> <script><br /> $(function(){<br /> //对象<br /> var goods = new Object();<br /> goods.id = 10;<br /> goods.name = "商品名称";<br /> <br /> alert($.toJSON(goods));<br /> <br /> //数组<br /> var arr = new Array();<br /> arr[0] = 10;<br /> arr[1] = "hello";<br /> <br /> alert($.toJSON(arr));<br /> //其他情况用到试试<br /> });<br /> </script>附件下载地址 : http://chajiandaquan.com/plugin/view/id/171.html

AD:真正免费,域名+虚机+企业邮箱=0元

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template