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元