我怎么能在ajax的数据中发送一个字典

时间:2021-06-02 19:34:28
data: {
    'data_params': data_params,
    'template_name': template_name,
    'channels': channels,
    'address': address,
    'task_name': task_name
}

address is like:

地址如下:

address -> { "links": '["abc","pqr"]' }

I have tried doing it like

我试过这样做

 var address = {'links':links};

but in post request it shows something like this:

但在帖子请求中它显示如下:

'address[links]': [u'["abc","pqr"]']

1 个解决方案

#1


0  

It is listed as a string not an array. therefore address["links"] is pointing to a string.

它被列为字符串而不是数组。因此address [“links”]指向一个字符串。

should be: address = { links: ["a","b"]}

应该是:address = {links:[“a”,“b”]}

#1


0  

It is listed as a string not an array. therefore address["links"] is pointing to a string.

它被列为字符串而不是数组。因此address [“links”]指向一个字符串。

should be: address = { links: ["a","b"]}

应该是:address = {links:[“a”,“b”]}