Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function petition_ajax_refresh() {
- $.ajax({
- url: settings.petition.api_base + '/petitions/' + settings.petition.petition_id + '.json',
- method: 'GET',
- cache: false,
- success: function(data) {
- var response = data.results[0];
- var width = 1;
- if (response.signatureCount < response.signatureThreshold) {
- var calc = (Math.round((response.signatureCount / response.signatureThreshold * 100) + "e+1") + "e-1");
- width = Math.max(calc, 1);
- }
- else {
- width = 100;
- }
- $('.signatures-needed', context).text(response.signaturesNeeded.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","));
- $('.signature-meter > span', context).width(width + '%');
- $('.signatures-number', context).text(response.signatureCount.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","));
- }
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement