[英]Reading a local xml file in Webstorm IDE.(+ node.js, ajax)
I am now using the latest Webstorm IDE for developing the webpage with Ajax. 我现在使用最新的Webstorm IDE来通过Ajax开发网页。
1. To read a local xml file, I start the server and access the localhost with chrome but I didn't read a local xml file. 1.要读取本地xml文件,我启动服务器并使用chrome访问localhost,但没有读取本地xml文件。
2. To read a local xml file, I use the Webstorm function in following image. 2.要读取本地xml文件,请使用下图中的Webstorm功能。
finally, I success the reading a local xml file. 最后,我成功读取了本地xml文件。
Thank you in advance!! 先感谢您!!
========================================================================== ================================================== ========================
<script type="text/javascript"> $(function () { $('#resourceName').click(function() { $.ajax({ url: "ResourceFormat/xml/test.xml", type: "get", dataType: "text", cache: false, timeout: 30000, success: function(data) { $('#bodyText').val(data); }, error: function(xhr, textStatus, errorThrown) { alert(textStatus + ': ' + xhr); } }); }); }); </script>
It is because of Same-origin policy, you can reference to below links: 由于采用同源策略,您可以参考以下链接:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.