我正在尝试对Google Maps Geocoding Web服务进行jQuery $.getJSON调用,但由于跨域安全问题,这不起作用.
我无法在网上弄明白,但我已经阅读了一些关于Google Javascript API或JSONP的内容,但到目前为止还没有明确答案......
谁能让我高兴?
谢谢!
我的网站在Firefox和Chrome中都返回了一些奇怪的警告信息和错误.
Firefox返回以下错误:
GET http://fonts.googleapis.com/css?family=Varela+Round 200 OK 7c8e43d.js (line 18)
13:27:41.46 CSI/tbsd_
13:27:41.48 CSI/_tbnd
Run Code Online (Sandbox Code Playgroud)
Chrome会返回此错误:
XMLHttpRequest cannot load http://fonts.googleapis.com/css?family=Varela+Round. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin is therefore not allowed access.
Run Code Online (Sandbox Code Playgroud)
我猜这个问题与谷歌字体API有关,Access-Control-Allow-Origin我该如何解决这个错误呢?
假设我有一个当前的网址显示 http://localhost.com/welcome/blah_blah,从这个网址我希望只能http://localhost.com/ 进入一个页面.
这该怎么做??
我知道echo current_url();给出了完整的网址.但我只想要http://localhost.com排除controller_name,clasname等.
预期产出
如果我的base_url = http://www.exaple.com/folder¤t_url = http://exaple.com/folder/class/method/blah_blah,那么我想要的域名exaple.com不是www.exaple.com !
我正面临一个问题.