Mailchimp API Getting Error And Can't Use Ajax Success
I have problem with getitng correct response from mailchimp API V2.0. When I try subscribe new user var arr = { apikey:'xxxx', id:'secretListId', e
Solution 1:
This API is not meant to be used by code in the browser for a very specific reason.
By making this request in the browser, anyone who uses the page that makes this request will be able to take your api key and make their own requests to the api as if they were you, thus allowing anyone to steal all of the email addresses that are added to your list (and even empty the list.)
You must interact with this api using a server-side language such as PHP. Doing otherwise is compromising the security of your users/customers.
Solution 2:
function jsonpCallback(data){
alert(JSON.stringify(data[1]));
return data;
}
$.ajax({
type: 'POST',
url: 'http://xxx.us6.list-manage.com/subscribe/post-json?u=copiedFromActionForm&id=idList&c=?',
data: data,
cache: false,
dataType: 'jsonp',
success: function(data, text, xhr){
alert(JSON.stringify(data.msg));
},
error: function (xhr, text, error) {
console.log('error')
console.log(JSON.stringify(xhr.msg));
}
});
In the alert popup you will get message.
Idea of solution taken from https://github.com/scdoshi/jquery-ajaxchimp
Post a Comment for "Mailchimp API Getting Error And Can't Use Ajax Success"