跨域异常 [英] Cross domain exception

查看:728
本文介绍了跨域异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在网址上传了我的wordpress博客: http://blog.in

I uploaded my wordpress blog on url : http://blog.in

我在调用以下url时遇到跨域异常

I am getting cross domain exception while calling following url

                $.ajax({
                          type: "POST",
                          url: "http://app.blog.in/getToken",
                          contentType: "text/html",
                              success: function(msg) {
                                            alert(msg);
                          }
                    });

请向我建议

p>

推荐答案

由于从不同的子域加载,浏览器安全性不允许。
除非您可以将要加载的数据移动到同一个域(即同一个子域),否则您应该使用 JSONP 。然后,您可以从任何地方加载数据。

Since you are loading from a different subdomain, browser security doesn't allow that. Unless you can move the data you're loading to the same domain (that's same subdomain as well), you should look into using JSONP. Then you can load data from anywhere.

这篇关于跨域异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆