I have 2 files named index.html
and mytext.txt
in the same folder. I want to get contents of mytext.txt
using an ajax call in the index.html
. I use this code but it is only working in firefox not chrome:
$.ajax({
url: "mytext.txt",
dataType: 'text',
success: function(data) {
alert(data);
}
});
I am opening index.html simply from explorer not server!
由于跨源政策,我认为您必须启动网络服务器才能在chrome中工作
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.