I\'ve looked through every answer i can find on here and can\'t solve this. I\'m pretty sure I havn\'t missed anything obvious.
I\'m trying to load map markers base
your tags are in CDATA section so they are ignore as tag by the parser.
You can try parsing XML yourself:
var parser = new DOMParser();
var xmlDoc = parser.parseFromString(xmlhttp.responseText, "application/xml");
Like this.
I wonder why you want the parser to skip almost your entire http response body, it seems there is no need, it's not containing anything that could be misinterpreted. It even is the data you want to get parsed, that you hideaway in your example for no apparent reason.
Look here for some explanation of CDATA: http://www.w3schools.com/xml/xml_cdata.asp
You could try commenting out the opening and closing CDATA statement like mentioned here: http://de.selfhtml.org/html/xhtml/unterschiede.htm
They also state, that the XML parser assumes UTF-8 encoding by default and will refuse parsing if not configured correctly, and that overwriting the exspected type via the response header is not recommended.
I prefer to avoid opening and closing php blocks inside block-statements the way you did it, but I'm not quite up-to-date with the latest coding conventions, so I may be wrong on that one.
<?php
header('Content-type: text/xml');
header ('Cache-Control: no-cache');
header ('Cache-Control: no-store' , false);
$response ='<?xml version="1.0" encoding="UTF-8"?>
<properties>';
if ($body != null):
foreach ($body as $property):
$response .='<property>
<lat>'.$property->lat.'</lat>
<long>'.$property->long'.</long>
<name>'.$property->property_name.'</name>
</property>';
endforeach;
endif;
$response .='</properties>';
echo responseText;
?>