像这样的东西有效。我们使用$
将字符串转换为 jQuery 对象。然后,您可以使用普通的 jQuery 调用(如filter)来获取电子邮件列表。
然后创建一个列表。然后将每封电子邮件附加到它。
http://jsfiddle.net/BCmqL/3
//just hardcode in an example of your data
var ajaxData = '<div id="1" class="clicked">A</div><div></div><div id="2" class="clicked">B</div><div></div><div id="3" class="clicked">dsf</div><div></div><div id="4" class="clicked">fd</div><div class=users>pp@gmail.com,pp1@gmail.com</div>';
//turn it into a jQuery object, now you can just use jQuery to do stuff
$jObject = $(ajaxData);
$emails = $($jObject).filter('div.users').text();
//split the list to get all the emails
var emails = $emails.split(',');
//create a list to add list items to
var $ul = $('<ul />');
//iterate through list and append them to a ul
$(emails).each( function(index, value) {
var $li = $('<li>'+value+'</li>');
$ul.append($li);
});
//append new list to body
$('body').append($ul);