just started learning jquery not know deep mechanics such errors.
i using jquery parse xml file html page folder structure structured in following way
client
-currentfiles -test.xml -stations -test.html i using jquery cdn google load jquery library.
this code
<script type="text/javascript"> var data = []; $(document).ready(function () { $.ajax({ type:'post', //just echo datatype: "xml", // type of file trying read url: './../currentfiles/test.xml', // name of file want parse success: parse, // name of function call upon success async: false, error: function(xhr, status, error) { alert("error"); console.log(error); console.log(status); } }); function parse(xmldata) { $(xmldata).find("value").each(function(){ alert($(this).text()); data.push($(this).text()); }); } console.log("data array:" + data); }); </script> the xml file formatted in following way
<?xml version="1.0" encoding="utf-8"?> <values> <value date="2015-07-12">37.170</value> <value date="2015-07-13">7.190</value> <value date="2015-07-12">37.170</value> <value date="2015-07-12">3.210</value> <value date="2015-07-12">37.20</value> the error getting
domexception [ns_error_dom_bad_uri: "access restricted uri denied"
code: 1012
nsresult: 0x805303f4
location: https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js:4]
i not understanding error on side file not have write permissions or dealing cdn?
by way using firefox.
you can develop locally in ff3 modifying security permissions. can following these steps:
type about:config location bar (address bar) , press enter click “i’ll careful, promise” button change security.fileuri.strict_origin_policy: true local documents have access other local documents in same directory , in subdirectories, not directory listings. (default)
false local documents have access other local documents, including directory listings.
Comments
Post a Comment