-1
I made this js code to take input data (THIS GETTING THIS PART OK) from the page and send it to VTEX (IS NOT SENDING). Must be some detail you forgot about. I’ve done several js to capture the data, register at VTEX and then trigger an event (EMAIL THE USER) and never had a problem. The problem is that this js does not need to have any event, IE, will not send email to the user, I just want to collect the data.
(function($){
if(typeof newsButtonClick == "function"){
newsButtonClick = function(instanceId) {
var clientName = $('#' + instanceId + ' .newsletter-client-name').val();
var clientEmail = $('#' + instanceId + ' .newsletter-client-email').val();
var internalPage = $('#' + instanceId + '#newsInternalPage').val();
var internalPart = $('#' + instanceId + '#newsInternalPart').val();
var internalCampaign = $('#' + instanceId + '#newsInternalCampaign').val();
if (clientName.length > 0 && newsCheckEmail(clientEmail)) {
var dataToPost = { newsletterClientName: (clientName == originalNewsNameFieldValue ? "" : clientName), newsletterClientEmail: clientEmail, newsInternalPage: internalPage, newsInternalPart: internalPart, newsInternalCampaign: internalCampaign };
var url = '/no-cache/Newsletter.aspx';
newsletterAjaxRequest('POST', url, dataToPost, '#' + instanceId + '.newsletter', '');
var now = new Date();
var y = now.getFullYear(),
m = now.getMonth(),
d = now.getDate(),
fullDate = y+"-"+(m+1)+"-"+d
try {
lista : {
nm_lista : "teste";
nm_email : clientEmail;
nome : clientName;
atualizar : "1";
dt_cadastro : {
valor : fullDate;
atualizar : "1";
}
}
console.log("ok");
} catch (e) {
console.log(e);
}
}
}
}
}(jQuery));