Hi, I m new to CakePhp and JQuery. I am getting an error in using the cakephp code inside my JQuery.
My code
   <script type="text/javascript">
     $(document).ready(function(){
     var attributeid;var fieldname;
     $("#"+<?=$r['Attribute']['id'];?>).change(function () {
  fieldname=<?=$r['Attribute']['label'];?>; 
              alert(fieldname);//this show me that undefined 
             attributeid=<?=$r['Attribute']['id'];?>; 
             alert(attributeid);//But this works
    });//attribute change
});//ready function
if i echoed( $r['Attribute']['label'];) this value its coming inside my . But not inside my JQuery..
    Note : but my 
             attributeid=<?=$r['Attribute']['id'];?>; 
             alert(attributeid);//But this works
Error: 
Name is not defined
fieldname=name; 
alert(fieldname);
Please suggest me.....