Ionic V1 $ http发布json数据参数

时间:2017-07-07 04:30:59

标签: javascript angularjs ionic-framework

我有两个由sqlite执行生成的对象:

var info_update = {
id: 270,
cancelados: 2,
concluidos: 2,
total: 914
}

var participantes = [
    {id: "10",
     nome: "Antonio",
     idade: "4",
     ativo: 1,
     msg: "Backorder"
     },
    {id: "11",
     nome: "Carlos",
     idade: "1",
     ativo: 1,
     msg: "Flagged"
    }
]

对于发送对象,我在服务上使用此方法:

var headers = {
            'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
        };
    return $http({
        method: "POST",
        url: "remote_url.com/action",
        data: {info_update: info_update, participantes: participantes},
        headers : headers
    })

问题是什么?

The parameter info_update it's sent to server, but the parameter participantes it's send empty, as appears in the attached image

我需要发送所有服务数据。 我是怎么做到的?

1 个答案:

答案 0 :(得分:0)

您的participantes不是对象,其数组尝试使用.map函数将其更改为对象