Is it possible to fill jQuery variable by PHP???
I mean something like this:
<?php
$string_php = "50%";
?>
And with “$string” variable I want to fill jQuery:
var jquery_string = "$string_php";
$('.bar1').animate({'height':'jquery_string'},500);
The code above is only idea how I would like to be working
Sure
Since PHP is processed first on the server and the result is then sent to the user’s browser, this is easy, and often done.
The above code would result in:
You would, however want to modify your second line, removing the quotes from the variable so it was:
since keeping the quotes around
jquery_stringwould make force it to be interpreted as a string whereas you want a variable.The end result would be the equivalent of: