//response = [{"id":"1","created":"26-05-2016"},{"id":"2","created":"25-05-2016"},{"id":"8","created":"21-05-2016"}]
success : function(response){
var obj = JSON.parse(response);
//这里我想创建关联数组...就像array['user'] = id
& array['created']
..
请帮帮我
答案 0 :(得分:2)
只需尝试这个
var response = [{"id":"1","created":"26-05-2016"},{"id":"2","created":"25-05-2016"},{"id":"8","created":"21-05-2016"}];
var output = response.map(function(obj){ return { user: obj.id, created: obj.created } })
console.log(output)