Origin http://localhost:8080 is not allowed by Access-Control-Allow-Origin.

用谷歌浏览器打开我的ajax小程序,发现错误:Origin http://localhost:8080 is not allowed by Access-Control-Allow-Origin.

根据网上说是跨域问题,我想可能是因为我在浏览器上打的地址是localhost,在ajax请求中用的地址是127.0.0.1,所以我将浏览器上的地址改为127.0.0.1,就没有错误了。

或者将ajax中的请求地址设置为相对路径,也没有错误

posted @ 2012-07-08 14:33  winnerX  阅读(3500)  评论(1)    收藏  举报