Unexpected token breaks function

Hello. Back to this ddList. I am trying to populate new element once the user selects a drop down from the second list through. The info is coming through a test xml file.

I think i got the xml call correct, but am not sure. As something is breaking the script. I have been over it but see no unexpected token.

1 Like

All right made some progress but even though i have this at the top of the xml

<?access-control allow="*/htdocs/jsCoding/eightPage.php" http://codepen.io/pdxSherpa/pen/BjEOPj"?>

i get this

XMLHttpRequest cannot load http://agileart.us/dataTestArea/data1XML.xml?_=1456262329025. No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘null’ is therefore not allowed access.

Your tag specified access-control but the error message says it can’t find Access-Control-Allow-Origin

1 Like

yep. it’s there

http://agileart.us/dataTestArea/data1XML.xml

Other than it not being well-formed
<?Access-Control-Allow-Origin: *?>

XML Parsing Error: not well-formed
Location: http://agileart.us/dataTestArea/data1XML.xml
Line Number 2, Column 30:<?Access-Control-Allow-Origin: *?>
------------------------------------------------------^

I’d like to know where you found that. I thought it was an HTTP header thing not an XML tag.

like I said am 99.9% new to this xmlish stuff so don’t even know if it was formatedd corectly but saw something like it.

the bit above:

Access-Control-Allow-Origin: *

was found here.

So i just put it in an xml linter (should have thought of that) & the error is “2:3 The processing instruction must begin with the name of the target.” but how can I fix this so it works?

Yes, that is not an XML tag. It is an HTTP header.

In PHP you would have something like (I don’t know if this is the correct syntax)

<?php 
header('Access-Control-Allow-Origin: *');

in the file that outputs the XML

just tried that too, got it it here.

still nothing.

Hmm, or some reason the header isn’t being sent

HTTP/1.1 304 Not Modified
Date: Tue, 23 Feb 2016 22:35:03 GMT
Server: Apache
Connection: Keep-Alive
Keep-Alive: timeout=15, max=100
Etag: “444ba60-7b6-52c777d202330”

Maybe just a matter of time waiting for the Modified to change?

why wouldn’t it show up in codepen if it was ok though?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.