标签:obj asc jquery 个数 class put string i++ for
一,直接上代码
<script src="../../Content/jquery-2.0.3.min.js" type="text/javascript"></script> <script type="text/javascript"> function aa() { var json = []; var j = {}; for (var i = 1; i < 5; i++) { j.name = "name"; j.cars = "22"; j.obj = "457"; json.push(j); } var a = JSON.stringify(json); alert(a); } </script> <div> <input type="button" value="提交" onclick="aa()" /> </div>
综上:理解是定一个数组和一个对象,将对象插入到数组,然后装换成JSON字符串的逻辑
标签:obj asc jquery 个数 class put string i++ for
原文地址:http://www.cnblogs.com/May-day/p/6841958.html