lzk318

//jq数组

var arr = [1,2,3];

//把数组转换为json ajax 传递参数的时候不能直接传递数组 转换为json 可直接传递

  var datas = JSON.stringify(arr);

// ajax

$.ajax({
            url:"",//传递地址
            data:{datas:datas}, //传递参数
            type:\'post\', //传递方式
            dataType:\'json\', //后台返回格式
            success:function(rem)
            {
              //成功后的处理方法
            }
         })

//php 接值 处理

$datas = trim($_POST[\'datas\']);//直接用post方法接值就可以

//把传递的数据进行处理

$data = json_decode($_POST[\'datas\']); //使用json_decode把json数据 转换为数组 以便于后边的处理

分类:

技术点:

相关文章: