Skip to content

Instantly share code, notes, and snippets.

@rbaty-barr
Last active December 15, 2018 15:32
Show Gist options
  • Save rbaty-barr/ba7317888559477915d44f46180f8789 to your computer and use it in GitHub Desktop.
Save rbaty-barr/ba7317888559477915d44f46180f8789 to your computer and use it in GitHub Desktop.
get total number of plays
<script>
function addCommas(nStr)
{
nStr += '';
x = nStr.split('.');
x1 = x[0];
x2 = x.length > 1 ? '.' + x[1] : '';
var rgx = /(\d+)(\d{3})/;
while (rgx.test(x1)) {
x1 = x1.replace(rgx, '$1' + ',' + '$2');
}
return x1 + x2;
}
$.ajax({
url: "https://www.podbean.com/api2/public/filesPlays",
type:"GET",
data:{"blogId":"2117688","query":[{"file":"allFile","w":"7b234821"}]},
dataType:"json",
success: function(result) {
if(result.code =="200")
{
if(result.data.allFile >100000 )
{
jQuery("span.counts").css("font-size","15px");
}
jQuery("#home_visitor_stat").text(addCommas(result.data.allFile));
}
}
}); </script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment