https://blog.csdn.net/sjszscx/article/details/89066725
<script>
function updateUser(obj){
console.log(obj.name);
};
var tem = {name:'haha',go:'hehe'};
updateUser(tem);
var tem1 = {name:'haha1',go:'hehe1'};
var s = [tem,tem1];
var tem = JSON.stringify(s);
var gos = JSON.parse(tem);
$.each(gos,function(index,item){
var dela = "<button type=\"button\" class=\"btn btn-default\" onclick=\'updateUser("+ JSON.stringify(item) +");\'>修改</button>";
$("table").append("<tr>"+
"<td>"+item.name+"</td>"+
"<td>"+item.go+"</td>"+
"<td>"+dela+"</td>"
+"</tr>");
});
</script>
网友评论