Note that there are some explanatory texts on larger screens.

plurals
  1. POunable to load xml from external file using jQuery
    text
    copied!<p>I'm trying to load external xml using the following code but it is not working </p> <pre><code>$( document ).load( "data.xml", function( response, status, xhr ) { console.log( xhr.status + " " + xhr.statusText ); }); </code></pre> <p>I have both <code>data.xml</code> and <code>js</code> file in same folder.</p> <p>In <em>chrome</em> it returns <strong><code>404 error</code></strong>.</p> <p>In <em>FF</em> it retuns <strong><code>0 [Exception... "Access to restricted URI denied" code: "1012" nsresult: "0x805303f4 (NS_ERROR_DOM_BAD_URI)"</code></strong>.</p> <p>I couldn't understand why this happens? Please shed some light on this issue.</p> <p><strong>Updates:</strong> I gave a shot using <strong><code>$.get()</code></strong> as mentioned below but still no success.</p> <p>Meanwhile I also gave a try using pure js like below</p> <pre><code>function loadXMLDoc(dname) { if (window.XMLHttpRequest) { xhttp=new XMLHttpRequest(); } else { xhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xhttp.open("GET",dname,false); xhttp.send(); return xhttp.responseXML; } xmlDoc=loadXMLDoc("data.xml"); console.log(xmlDoc); </code></pre> <p>Still facing errors.</p> <blockquote> <p><strong><em>Error in FF:</em></strong> NS_ERROR_DOM_BAD_URI: Access to restricted URI denied [Break On This Error] </p> <p>xhttp.send();</p> </blockquote> <p>and </p> <blockquote> <p><strong><em>Error in chrome:</em></strong> XMLHttpRequest cannot load file:///C:/Users/admin/Desktop/public_html%281%29/public_html/data.xml. Cross origin requests are only supported for HTTP. xml.js:13 Uncaught NetworkError: A network error occurred.</p> </blockquote> <p><strong>Updates:</strong> I found this <a href="https://stackoverflow.com/questions/6653825/error-access-to-restricted-uri-denied">question</a> useful, but is there any way to solve this problem?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload