javascript - Pass php variable to jquery script is not working -


i have following jquery script:

<script>         $(document).ready(function () {             $(".clickable").click(function () {                 $(this).animate({left: '1030px'}, function () {                     $(this).fadeout("slow", function () {                         document.location.href = $(this).get(0).id + ".php";                     });                 });             });          });         $(document).ready(function () {             $("#chi").animate({left: '0'}, {duration: 200, queue: false});             $("#dove").animate({left: '0'}, {duration: 400, queue: false});             $("#quando").animate({left: '0'}, {duration: 600, queue: false});             $("#cosa").animate({left: '0'}, {duration: 800, queue: false});             var phpvariable=<? echo $row; ?>             $('.dreams-photo-profile-mydream').css({"background": "url(\"/images/user.png\")"});             $('.dreams-photo-profile-mydream').css({"background-repeat": "no-repeat"});             $('.dreams-photo-profile-mydream').css({"background-position": "center"});             $('.dreams-photo-profile-mydream').css({"background-size": "contain"});          });      </script> 

and i'm trying pass php variable so:

   <?php     $gdb->connettidb();     $row = $gdb->getfotoprofilo(getid());     ?>   var phpvariable=<? echo $row; ?> 

that 's not working. when declare var inside script, seems blocked , animations aren't working , don't know why. can explain me how can that?

wrong use of php:-

var phpvariable=<? echo $row; ?> 

it should be

 var your_variable='<?php echo $row; ?>'; 

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -