I use this http://goo.gl/d3vLW code for my project, but it’s not working the way how I want it.
Using Codeigniter I just modified the downloadUrl function phpsqlajax_genxml.php to controller/method
The problem: if I use header(“Content-type: text/xml”); in the method, I get the following error:
XML Parsing Error: junk after document element
Location: http://localhost/website/
Line Number 3, Column 1:<!DOCTYPE html>
^
Viewing the source code the generated xml is before my template php html tag…
If I comment out the header() , I get no markers on the map.
If I add the following line
request.overrideMimeType('text/xml');
in the javascript part of the code to the end of downloadURL function, markers are there, page is working successful, but why I have the xml again before the template php html tag?
As I guess, the php method should pass the generated xml to the javascript function, but not in “visible mode”, hmm?
So..
-
why I get error using header() – as in the example – in my method?
-
If I stuck with te second solution that works, how to pass xml without storing it before the template file html tag? It’s ugly and increase file size..
Thanks
Could it be that you have output the XML in the controller method, and then load the view? I’m just guessing, you didn’t post the whole code?