in my home.php file i hv defined one path as javascript variable like below:

<?php $path= "http://localhost/tiffany/" ?>

 <script type="text/javascript" src="<?php echo $path; ?>js/manuals.js"></script>

 <script type="text/javascript" > 
  var  templateUrl  = '<?php echo $path; ?>'; 
  </script>

& in my 'manuals.js' file i have included someother js files adding with that variable:

include(templateUrl+'js/mathUtils.js');
include(templateUrl+'js/superfish.js');
include(templateUrl+'js/switcher.js');
and so on....

no err for 'manuals.js' file but get error for all inlcuded .js files:
ReferenceError: templateUrl is not defined

please hlp me whr to change or edit ..

Recommended Answers

All 2 Replies

Do this ...

<?php $path= "http://localhost/tiffany/" ?>
<script type="text/javascript" >
var templateUrl = '<?php echo $path; ?>';
</script>
<script type="text/javascript" src="<?php echo $path; ?>js/manuals.js"></script>

great ... thanks man

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.