How to read local xml file using javascript? -
maybe problem wrote path file incorrectly, i'm using linux, have write path in different way?
<script type="text/javascript"> function func(){ var xmlfile = new xmlhttprequest(); xmlfile.open("get", "/home/kat/course/data.xml", false); xmlfile.send(); xmldoc = xmlfile.responsexml; document.getelementbyid("result_field").value = xmldoc; } </script>
the file needs in webroot. if have code in /var/www , site 'somedomain.com/index.html' need have xml file in same /var/www directory , access "get", "somedomain.com/anotherfolder/data.xml"... can't access server directories js... javascript runs on client side, not on server side, file needs accessible on website.
Comments
Post a Comment