Quantcast
Channel: Adobe Community : All Content - Edge Animate
Viewing all articles
Browse latest Browse all 9897

Save AJAX Load() Results As A Variable

$
0
0

Hi,

 

I am building a fundraising progress bar in Adobe Edge which has gone mostly smoothly.  When I enter a number for the variable I have called "total" ( var total = 45; ) and run the project in a browser, it works exactly as I want it to and I have uploaded the project to the server where it will be used.  However, I am not much of a programmer and I am having a hard time getting the data I need to load the current percentage raised toward the fundraising goal into the project.  The data I need is on a page on the website that the animation will be embedded on.  The only content on that webpage is the number I need.  Using jQuery, I haven't been able to load that number into the variable that's necessary for stopping the counter and animation for the progress bar.  At first, I tried to pull the data from a single div based on the ID of the div, but I eventually gave up on that much granularity and just stripped the site template for that page until only the number was left.

 

When I use this code:

var total;  $.get('http://www.mySite.org/restoftheurl?tmpl=minimal', function(data) {  total = data;  });

 

The counter counts to 100, which is the max I have set and the animation doesn't play.  I don't know what causes the counter to go but clearly, that doesn't work.

 

If I use this code:

var total = $.load("http://www.mySite.org/restoftheurl?tmpl=minimal");

 

Neither the counter nor the animation do anything, so that doesn't work either.

 

I have scoured the internet for days reading post after post where someone has had great luck with this bit of code or that bit of code.  I have tried at least 4 dozen different ways to make this happen and nothing is doing it.  I'm sure I am overlooking something stupid, but if anyone has a solution, I would be very appreciative!  Here is the rest of my action code (it is all in compositionReady tied to the Stage layer).

 

var counter_delay = 20;
var max_count = 100;
var present_count = 0;
var total = arghghghghghghghghg!;

var timer = window.setInterval(stepUp,counter_delay);
function stepUp(){
present_count++;
sym.$("number").html(present_count);
if(present_count==total)
clearInterval(timer);
if(present_count>=max_count){  sym.$("Text").html(100);  clearInterval(timer);
}}

var animation_ms = total*20;

sym.play(0);
setTimeout(function () {sym.stop()}, animation_ms);


 

Hopefully, someone smarter than I am has an idea what I am missing.  Thanks!


Viewing all articles
Browse latest Browse all 9897

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>