Hello everyone,
I'm trying to embed this Signup Form using HTML & Javascript, I got the template from Bootstrap.
I'm having trouble to get the field_margin right through Mailchimp.
The only data that passing is the mail address. So no ( FNAME & LNAME )
Please keep on mind, I'm a beginner and studying the web development it was a real challenge for me being dyslexic.
Can someone tell me how I can solve this problem?
Please see the JV code below!
Many thanks
CODE: __________________________________________________________________________
const express = require("express");
const bodyParser = require("body-parser");
const request = require("request");
const https = require("https");
const app = express();
app.use(express.static("public"));
app.use(bodyParser.urlencoded({
extended: true
}));
app.get("/", function(rec, res) {
res.sendFile(__dirname + "/signup.html");
});
app.post("/", function(req, res) {
const firstName = req.body.fName;
const lastName = req.body.lName;
const email = req.body.email;
const data = {
members: [{
email_address: email,
status: "subscribed",
marge_fields: {
FNAME: firstName,
LNAME: lastName,
}
}]
};
const jsonData = JSON.stringify(data);
const url = "https://us2.api.mailchimp.com/3.0/lists/XXXXXXX";
const options = {
method: "POST",
auth: "Imminxxxxx:XXXXXXXXXXX1b8fc263aaaf-us2",
}
const request = https.request(url, options, function(response) {
response.on("data", function(data) {
console.log(JSON.parse(data));
})
})
request.write(jsonData);
request.end();
});
app.listen(3000, function() {
console.log("Server is running on port");
});
Top comments (0)