Cross domain exception

一曲冷凌霜 提交于 2019-12-25 00:26:02

问题


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

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);
                          }
                    });

Please suggest me

Thanks


回答1:


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.




回答2:


You are getting a cross-domain error because you are crossing domains: app.blog.in and blog.in. You should serve the content from the same domain as where you post it.



来源:https://stackoverflow.com/questions/4932779/cross-domain-exception

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!