1

I have this js script. Instead of "2175" I'd need to insert here a certain $x php variable. How do I go about that?

var options = {
useEasing : true, 
useGrouping : true, 
separator : ',', 
decimal : '.' ,
prefix : '' ,
suffix : '' 
}
var demo = new countUp("myTargetElement", 0, 2175, 0, 2.5, options);
demo.start();
3
  • var demo = new countUp("myTargetElement", 0,<?php echo "2175" ?>, 0, 2.5, options); or you can use ajax Commented Mar 1, 2015 at 15:33
  • Not working I'm afraid, I need $x variable to be inserted, please be more specific about how to achieve it using ajax Commented Mar 1, 2015 at 15:44
  • Ok I figured it out: counter = '<?php echo $x ;?>'; var options = { useEasing : true, useGrouping : true, separator : ',', decimal : '.' , prefix : '' , suffix : '' } var demo = new countUp("myTargetElement", 0, counter, 0, 2.5, options); demo.start(); Commented Mar 1, 2015 at 16:40

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.