報錯提示如下:
XMLHttpRequest cannot load http://www.xxxx.com/264/Data/GetScreenInfo. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.
今天需要做一個本地測試,html中的js效果涉及跨域拉取數據的問題,Chrome報錯並拒絕數據的提取,,,,
有一個便捷的處理方式可以在谷歌中實現數據跨域,只需要簡單為瀏覽器鍵入一個值 --disable-web-security (這個值前有空格哦O(∩_∩)O~)后點擊確定。
如下圖:
Tip:首先重啟瀏覽器,再打開需要測試的文檔即可。
查看鏈接:
CORS(跨域資源共享) http://www.360doc.com/content/14/0106/11/15643_343005039.shtml
新W3C標准中 AJAX 跨域實現以及隱患 http://huaidan.org/archives/2729.html
跨域訪問資源 http://technet.microsoft.com/zh-cn/sqlserver/e36ceae6-ff36-4a1b-9895-75f0eacfe94c