我有一个来自 sql 数据库的这样的值列表。
UserName Email ComputerName DateIssued
jjsmith jjsmith@example.com JTComputer 9/14/2013
ltjoseph ltjoseph@example.com LTComputer1 10/21/2013
KTsmith KevinTem@example.com KTComputer1 01/25/2012
ltjoseph ltjoseph@example.com LTComputer2 01/11/2013
KTsmith KevinTem@example.com KTComputer2 01/25/2012
我将列表转换为对象数组。
var user_array = [
{"username":"jjsmith", "email":"jjsmith@example.com", "computerName":"JTComputer", "dateissued":"10/21/2013"}
{"username":"ltjoseph", "email":"ltjoseph@example.com", "computerName":"LTComputer1", "dateissued":"10/21/2013"}
{"username":"KTsmith", "email":"KevinTem@example.com", "computerName":"KTComputer1", "dateissued":"01/25/2012"}
{"username":"ltjoseph", "email":"ltjoseph@example.com", "computerName":"LTComputer2", "dateissued":"01/11/2013"}
{"username":"KTsmith", "email":"KevinTem@example.com", "computerName":"KTComputer2", "dateissued":"01/25/2012"}]
其他人创建了一个向用户发送电子邮件的函数,它只接受两个字符串参数。所以我不想为每个用户发送超过 1 封电子邮件。所以我试图弄清楚如何将这些项目组合在一起,以便我的一组示例字符串看起来像这样。
var str1 = "ltjoseph@example.com";
var str2 = "ltjoseph, LTComputer1-10/21/2013, LTComputer2-01/11/2013";
然后触发另一个用户函数为列表中的每个项目发送电子邮件。
function sendEmails(str1, str2);
如果有人有任何想法我该怎么做。请指教..