I have two URLs that are generating subscriber counts. I'd like to find a way to show their counts added together.
Admittedly, I know little about Javascript, so my attempt hasn't worked.
Here's what I had tried:
<script>
var count = 0;
var camp = ['lzlitki','admin_682519'];
var idx = 0;
function next() {
if ( idx == camp.length ) {
alert('total '+count);
return;
}
$.ajax({
url:'https://app.getresponse.com/display_subscribers_count.js?campaign_name='+camp[idx++]+'&var=0',
dataType: 'jsonp',
success:function(json){
count += json.counter;
next();
},
error:function(){
alert('Error');
},
});
}
next();
</script>
Would anyone be willing to help me see what's missing?