Hi all,

Ive been exploring various solutions for the following and was
interested to hear other opinions:

>From AJAX call: "[{content: 'some html 1', data: 'some data 1'},
{content: 'some html 2', data: 'some data 2'}, ... , {content: 'some
html N', data: 'some data N'}]"

Desired: Take the array from above, wrap the content values in a div
and then attach the data to the div. After this, set the new divs to
be the content of another element.

My first thought was to put the array through a map:
$.map(ARRAY, function(a) {
        return $('<div>').html(a.content).data('testValue', a,data);
});

however, you can't simply just take the output from that and use it as
an argument in another element's html method:
// Won't work
$('<div>').html($.map(ARRAY, function(a) { return $('<div>').html
(a.content).data('testValue', a,data);}));

Ive been working through a few solutions, none of which I find to be
very elegant... so, any thoughts on an elegant solution out there?

Reply via email to