Custom mailchimp signup form in React

前端 未结 4 1891
后悔当初
后悔当初 2021-02-05 09:54

I have a react app that I would like to add mailchimp signup form to. I am building a custom signup form and have user sign up by entering their first and last name and email. I

4条回答
  •  忘掉有多难
    2021-02-05 10:36

    If someone is looking for a ready to use React solution (credit to @adriendenat in this answer):

    import jsonp from 'jsonp';
    import queryString from 'query-string';
    
    // ...
    
    const subscribeToNewsLetter = () => {
      const formData = {
        EMAIL: // your email string,
      };
      jsonp(`YOUR_URL/subscribe/post-json?u=YOUR_U&id=YOUR_ID&${queryString.stringify(formData)}`, { param: 'c' }, (err, data) => {
        console.log('err:', err);
        console.log('data:', data);
      });
    }
    

提交回复
热议问题