jquery - Accessing the data used in .load() -
when using .load() method load external php/html, how access data in external file?
say first file 'index.php' , contains like;
$('#contentcontainer').load('productcontent.php',{param1:'data.xml'}); inside 'productcontent.php' want able parse different xml files passing xml filename shown. however, don't know how access 'param1' within 'productcontent.php'
it there under
$_request['param1']; edit: on server need file called productcontent.php this:
<?php echo $_request['param1']; ?> edit2: if writing javascript in php file (which think bad idea, javascript files should kept away generated html) you'd this:
$(this).ready(function () { var d = <?php echo $_request['param1']; ?>; }); but pretty messy.
Comments
Post a Comment