我用的是谷歌浏览器
这是浏览器的报错
var newText ='${textUrl}';
var url =serverUrl + "/front/itemAlbum/searchText.do?textUrl="+newText;
$.ajax({
type: "POST",
async: false,
url: url,
dataType : 'jsonp',
jsonp:"jsoncallback",
success: function(json) {
debugger;
var jsonData = json.data;
$("#text").text(jsonData);
setTimeout(function() {
parseTextDatas();
}, ${val.textTime}*60000);
}
});
这是我的ajax方法
谷歌的快捷方式中 "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --enable-file-cookies --allow-file-access-from-files 我也添加了这个
请问还有什么方法可以解决一下这个问题
方法在ie10及以下版本有效
谷歌,火狐都无效
15:24:05.034 已拦截跨源请求:同源策略禁止读取位于 http://192.168.1.12/front/itemAlbum/searchText.do?textUrl=E:\xx\st.txt 的远程资源。(原因:CORS 头缺少 'Access-Control-Allow-Origin')。1(未知)
这是火狐的报错信息
我用的前端页面是freemarker
求给位大神有解决过类似问题的来一起交流一下,谢谢