Reply
Occasional Visitor
DaveM654
Posts: 2
Registered: ‎05-14-2012
Accepted Solution

JavaScript (Ajax) add new contact - possible?

[ Edited ]

The scenario:

 

- We have an existing form that is submitted to another 3rd-party service via their API

- We want to add a "Subscribe to newsletter" checkbox. If checked, the email address only will be sent to a Constant Contact List

 

To do these both with one form, I will need to make an Ajax request to the first service, and in the success handler, fire off the relevant data to the other service.

 

In the old days-- impossible. Cross-origin policy would block the script from executing. But now that a service can return a response with CORS headers set, it should be not only possible, but easy!

 

Problem: the other 3rd-party service does NOT currently set the necessary headers.

 

Question: does Constant Contact's API have a way to close the Ajax loop and trigger the success handler? It doesn't matter at all which order things go in; I'm happy to send to CC first and then the other service on success.

Mark-C
Posts: 181
Topics: 3
Kudos: 10
Solutions: 14
Registered: ‎07-23-2011

Re: JavaScript (Ajax) add new contact - possible?

Hello,

 

We have not implemented the cross-origin resource sharing (CORS), and are not likely to do so in the foreseeable future, so your best option is still to use a server-side solution.

 

Cheers,

Mark Coleman
Support Engineer
Occasional Visitor
DaveM654
Posts: 2
Registered: ‎05-14-2012

Re: JavaScript (Ajax) add new contact - possible?

Thanks, Mark. Not the answer I hoped for obviously (nor when Salesforce gave it to me!) but an answer nonetheless that lets me move forward with what I need to do.

 

Thanks again