We've been having some trouble with getting XML from our server. It returns 200 STATUS OK but, like the title notes, it's not returning the XML that we pointed it to but instead is giving back a complete EE Snippet! It's really weird.

The XML is well-formed (validation passed with no errors) and the 'var url = "OUR URL"' is well-formed (but can't share with you for obvious reasons).

Do you have any ideas as to why this would happen and what EE might be doing to make it happen?

EDIT 1: A quick note. When we add 'http://www.' to the beginning of our domain it returns a 404 STATUS. But when we remove it (leaving just our domain 'example.com') it returns a 200 STATUS. I'm not sure why this is.

Additionally, we are conforming to the Same Origin Policy (http://en.wikipedia.org/wiki/Same_origin_policy)

EDIT 2: The Snippet being returned contains the:

<!DOCTYPE html">
<html lang="en">

and we're calling the XMLHttpRequest() within the <script>...</script> within the body (contained in it's own template). Moving the XMLHttpRequest() into the <head> doesn't fix the issue.

EDIT 3: After changing the Template Manager -> Edit Preferences -> Type to Javascript it actually returns the Snippet as the web page (but only shows the markup). Vis., by doing this we're getting the same xhttp.responseText data. When we move the JS below into it's own template with the Preference Type to Javascript and {embed...} it we no longer get this problem but instead revert to the old one of getting a the Snippet instead of the XML.

Here's the Javascript:

<script type="text/javascript">


function sendRequest() {

    var url = "OUR URL";
    var xhttp = new createXMLHTTPObject();

    if (!xhttp) alert("XMLHttpFactories Not Applied");

    xhttp.open("GET", url, false);




var XMLHttpFactories = [
    function () {return new XMLHttpRequest()},
    function () {return new ActiveXObject("Msxml2.XMLHTTP")},
    function () {return new ActiveXObject("Msxml3.XMLHTTP")},
    function () {return new ActiveXObject("Microsoft.XMLHTTP")}

function createXMLHTTPObject() {
    var xmlhttp = false;
    for (var i = 0; i < XMLHttpFactories.length; i++) {
        try {
            xmlhttp = XMLHttpFactories[i]();
        catch (e) {
    return xmlhttp;



1 Answer 1


Ok so this was ridiculous easy to fix.

What we did was move the XML from it's static file and inserted it into its own template within our active template group and it worked. So if you're having this problem just template the XML and go nuts.

All we had to change in our JS here was

var url = "OUR URL";


var url = "{path='<our template group>/<our XML template>}";

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.