0

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?

jbcora
  • 3
  • 1

1 Answers1

0

You need to include jQuery by simply adding:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>

to your html (usually in the header).

props to @charlietfl for noticing first.

msanteler
  • 2,163
  • 1
  • 16
  • 21