using jquery .ajax

Occasional Visitor

using jquery .ajax

Hi I have this code below but can't get the .done to work.  Can anyone help??


$(document).ready(function() {
            $('#myForm').submit(function() {
                alert("the submit is working");
                var newSubscriber = JSON.stringify($('#myForm').serializeObject());

                    url: "",
                    contentType: 'application/json; charset=UTF-8',
                    type: "POST",
                    data: newSubscriber
                    alert("this worked");
                    alert("this didn't work");


Honored Contributor

Re: using jquery .ajax

Hello Robert,


This issue is likely the result of Cross Site Scripting(Or XSS for short) limitations present within a web browser environment. Due to these limitations, an AJAX call to pull in content from a different domain will fail. There are some methods such as CORS or JSONP that can allow for workarounds to this, but they currently are not supported by our API.


At this time, you would need a server-side script to POST the data, even if it simply resides on the same domain so that you can use AJAX and simply forward the request with your ser-ver side script.


If you do have any more questions, please let me know and I will be happy to assist you!



Elijah G.

Tier 2 Support

Elijah G.
API Support Engineer
Developer Portal

View API documentation, code samples, get your API key.

Visit Page

Constant Contact Would Like To Hear From You!

We want to hear from customers like you about your favorite features and how they have helped your business or organization. Tell us by answering a few questions in...

Read More