"Uncaught Syntaxerror: Unexpected token :" and "Access-Control-Allow-Origin"

Asked

Viewed 86 times

0

Guys I’m trying to do a Mailchimp integration, but I’m having problems with this mistake:

1 - Access-Control-Allow-Origin 2 - Uncaught Syntaxerror: Unexpected token :

I can’t find the problem. You can help me?

For the error "Access-Control-Allow-Origin"

formData = {
            u: "d6bd0bfa42c51cbaec3eb879b",
            id: "e943abd300"
        };

        $.ajax({
            url:"http://academiadopsicologo.us12.list-manage.com/subscribe/post",
            type:'GET',
            crossDomain:true,
            data:formData,
            dataType:'json',
            contentType:'application/json',

            success: function(data) {
                console.log(data);
            },

            error: function(data) {
                console.log(data);
            }

        });

For Uncaught Syntaxerror: Unexpected token :

formData = {
    u: "d6bd0bfa42c51cbaec3eb879b",
    id: "e943abd300"
};

$.ajax({
    url:"http://academiadopsicologo.us12.list-manage.com/subscribe/post",
    type:'GET',
    crossDomain:true,
    data:formData,
    dataType:'jsonp',
    jsonpCallback: 'callback',
    contentType:'application/json',

    success: function(data) {
        console.log(data);
    },

    error: function(data) {
        console.log(data);
    }

});

*Even if you change the subscribe/post to subscribe/post-json, nothing changes.

Anyone who can help me, thank you. I can’t locate the problem.

  • You know what CORS is?

  • i even understand a little, but nothing so deep. I even put in htaccess and php ( Access-Control-Allow-Origin: * ), but nothing.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.