我的是html里的数据是从数据库读出来的,在此可以理解为下面代码 用户1 用户2 用户3 用户4 jquery代码: var mt4Ids = []; $('input[name=uid]').each(function() { if(this.checked)">
输入banner图图片脚本导航/分类

jquery获取多个checkbox的值异步提交给php_jquery

html代码:


  
  <?=$item['mtaccount_id']?>
  <?=$item['account_id']?>
  <?=$item['account_name']?>
  <?=$item['server']?>
  <?=$item['platform']?>


我的是html里的数据是从数据库读出来的,在此可以理解为下面代码

  • 用户1
  • 用户2
  • 用户3
  • 用户4
  • jquery代码:

    PHP代码

     $mt4Ids = !empty($_POST['mt4Ids']) ? $_POST['mt4Ids'] : false;
     
     $stripMt4Ids = preg_replace('/[\"\[\]]/', '', $mt4Ids);
     $mt4IdsToArr = explode(',', $stripMt4Ids);
     
     foreach($mt4IdsToArr as $uid){
       permission_relation::add($uid, $gid);
     }
     $data = array(
       'state' => 1,
       'msg'  => '操作成功'
     );
     echo json_encode($data);
     return false;
    
    // $gid 可忽略
    

    以上所述就是本文的全部内容了,希望大家能够喜欢。