[英]Resolving undefined in email URL
I am getting undefined on my link at the variable productsList in the url url any ideas of what can be the problem? 我收到在URL URL什么任何想法可能是问题的变量产品列表未定义我的链接?
When I hover over the link it shows the string correctly but when its clicked it turns it into undefined 当我将鼠标悬停在链接上时,它会正确显示该字符串,但是在单击该链接时,它将变成未定义的字符串
MY CODE: 我的密码:
$(".emailCustomer").click(function(urlEmail){
var invoiceNumber = $(this).closest("li").find(".invoiceNumber").text();
// active subject invoice no.
var emailAddress = $(this).data("email");
var customerName = $(this).data("customer");
var productsList = $(this).data("products");
urlEmail = "https://mail.google.com/mail/?view=cm&fs=1&to="+emailAddress+"&su=+invoiceNumber+&body="+customerName+"%2C%0A%0A"+productsList+"%0A%0AEMAIL+SIGNATURE";
$(this).attr("href" , urlEmail);
$(this).attr("target" , "_blank");
return urlEmail;
});
<a class="emailCustomer" href="https://mail.google.com/mail/?view=cm&fs=1&to="+emailAddress+"&su=+invoiceNumber+&body="+customerName+"%2C%0A%0A"+productsList+"%0A%0AEmail+Signature" data-email="{{i.email}}" data-customer="{{i.name}}" data-products="{{i.products}}" target="_blank">
在您的代码上未设置data-products
属性,因此在您的点击回调productsList
中未定义。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.