I have problem with getitng correct response from mailchimp API V2.0.
When I try subscribe new user
var arr = {
apikey:"xxxx",
id:"secretListId",
email:{
email:"jd@example.com"
},
double_optin:"false"
}
function jsonpCallback (){
alert("jsonpCallback");
};
$.ajax({
type: 'GET',
url: 'https://us6.api.mailchimp.com/2.0/lists/subscribe.json',
dataType: 'jsonp',
jsonpCallback: 'jsonpCallback',
data: arr,
timeout: 4000,
cache: false,
async: false, success: function(data, textStatus, jqXHR) {
alert('success: '+data);
},
error: function(jqXHR, textStatus, errorThrown){
alert('error: '+JSON.stringify(jqXHR));
},
complete: function(jqXHR, textStatus){
alert('complete: '+JSON.stringify(jqXHR));
}
}).success(function(rsp){
console.log('success: '+rsp);
}).fail(function(xhr,error,thrownError){
console.log('fail status:[' + xhr.status + '] error:[' + thrownError + ']');
}).always(function(){
console.log('complete');
});
});
In inspector I'm getting error 500.
In this popup shold be another message (with error 500).
But when I past this link to browser I get:
{
"status": "error",
"code": 214,
"name": "List_AlreadySubscribed",
"error": "jd@example.com is already subscribed to list mpowroznik.com List. Click here to update your profile."
}
Of course if I add new e-mail I get popup alert
Why this is ERROR, not success ?
I'm using only jQuery without PHP or other language.
Function jsonpCallback isn't execute at all.
What I must do, to get correct response message.