var dataset = {"read_data":[{"date":"2010\/11\/02 03:30:05","value":"2"},
{"date":"2010\/11\/02 03:30:06","value":"1"}]};
var append = {"read_data":[{"date":"2010\/11\/02 03:30:07","value":"3"},
{"date":"2010\/11\/02 03:30:08","value":"4"}]};
I have two data objects like these two. How do 开发者_运维百科I use the JQuery.extend();
to merge them together? so that they look like this so that :
dataset === {"read_data":[{"date":"2010\/11\/02 03:30:05","value":"2"},
{"date":"2010\/11\/02 03:30:06","value":"1"},
{"date":"2010\/11\/02 03:30:07","value":"3"},
{"date":"2010\/11\/02 03:30:08","value":"4"}]};
All the methods contained in this site is not working at all.
jQuery.extend overwrites members with same names and does not support array merging. You'll need to do:
$.merge(dataset.read_data, append.read_data);
精彩评论