Google Maps Js V3 Xml Is Null
Im trying to retrieve the XML and put it into the var markers, when I run it the line var markers = xml.documentElement.getElementsByTagName('marker'); I get an error saying XML
Solution 1:
I have run your code from previous question with my generated XML with no errors. If the line header("Content-type: text/xml")
is removed in my file I get the error Uncaught TypeError: Cannot read property 'documentElement' of null
This shows you are not sending the header. Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP.
Try
header("Content-type: text/xml");
// Start XML file, create parent node$dom = new DOMDocument("1.0");
$node = $dom->createElement("markers");
$parnode = $dom->appendChild($node);
//Connect to database
Post a Comment for "Google Maps Js V3 Xml Is Null"