Need to pass the value of the variable php to javascript but I can not -


I have to pass variable php value in javascript, but I can not Try and do not work with the following versions, and not the reason for failure. Apache 2.2.25 and PHP 5.2.17 (I now need to work with these versions). Value which should be obtained in the example variable, "km l / AKMEMA_MagdalNeiKML"

  $ anio = $ line ['kml_map'];  
  & lt; Script & gt; Function initialize () {var mexico = new google.maps.LatLng (20.6568241, -103.3984801); Var map option = {Zoom: 11, map type id: google.maps.MapTypeId.TERRAIN, center: Mexico} var url2 = & lt ;? Php echo json_encode ($ anio)? & Gt ;; Var url1 = 'http://www.cnf.gob.mx:8090/snif/especies_forestales/'; Var map = new google.maps.Map (document.getElementById ('map-canvas'), map options); Var ctaLayer = new google.maps.kmlLayer ({url: url1 + url2}); CtaLayer.setMap (map);} google.maps.event.addDomListener (window, 'load', start); & Lt; / Script & gt;  

Check this line:

  var url2 = & Lt ;? Php echo json_encode ($ anio)? & Gt ;;  

If you intend to json_encode (I think this is the other way), you should use quotes like something

  var url2 = "& Lt; php echo json_encode ($ anio)? & Gt;";  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -