Somehow I keep getting error in javascript when I try to parse xml from php string, my code is like:
<?php
$xml = simplexml_load_file('file.xml');
$products = $xml->xpath("/products/product[@model='".$model . "']");
$filtered_xml = $products[0]->asXML();
?>
<script>
alert( $.parseXML( '<?php echo $filtered_xml;?>' ).find('name').text() );
</script>
echo $filtered_xml is returning a well formed xml as I am looking for, but something in the javascript - $.parseXML( '<?php echo $filtered_xml;?>' ) is causing errors. Thanks in advance for any help.