donglu6303 2017-03-22 08:31
浏览 27
已采纳

创建与php数组具有相同结构的javascript数组

In the sever side i have an array with structure like that:

array ('_1489378560544_544' => array (
                                     'customer_group_id' => '0',
                                     'permission_id' => 'disable_products_price',),
       '_1489740032764_764' => array (
                                     'customer_group_id' => '',
                                     'permission_id' => '',),)

So now in the client side i want to create an javascript array with the same structure to server side. Is there any possible way to do that?

So after i got all data separately how can i organize my array look like this

var arr = [{_1489378560544_544 : [customer_group_id : 0 , permission_id : 'permission_id'] }]

Here is my javascript get data function:

 $('#category_permission > tbody > tr').each(function() {
                var id = $(this).attr("id");
                var customer_group_id = $(this).children('td:first').children('select:first').val();
                var permission_id = $(this).children('td:nth-child(2)').children('select:first').val();
            });

Thanks for your help.

  • 写回答

3条回答 默认 最新

  • doufu8588 2017-03-22 08:34
    关注

    Something like this :
    var arr = [{_1489378560544_544 : [customer_group_id : 0 , permission_id : 'permission_id'] }]

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?