jQuery的阿贾克斯不工作的Facebook应用程序 [英] jquery's ajax not working in facebook apps
问题描述
我想创建一个Facebook应用程序,所有工作正常,只是我用来填充从第一个选择框中选择的项的第二个框阿贾克斯的部分。
I am trying to create a facebook application, all is working fine except the ajax part that I am using to populate a second box from the item selected in first select box.
我使用jQuery(V1.3.2)实现这个目标。这Ajax是工作,我已经采取了空间,它在主机上绝对没问题,但它不工作了Facebook。
I am using jquery (v1.3.2) for accomplishing this. This ajax is working absolutely fine on the host where I have taken space for it, but it is not working in facebook.
下面是我的问题,关于这个问题,
Here are my questions regarding to this problem,
- 在做画布页面URL必须是一样的,即我的应用程序名称。 (在我的情况是不同的)
我对父母选择框里面Facebook onchange事件收到此错误。
I am getting this error on the onchange event of parent select box inside facebook.
访问受限制的URI被拒绝code:1012
Access to restricted URI denied" code: "1012
- 在什么可能是错误的...?请帮我解决这个问题。
感谢
推荐答案
您不能从其他网站比脚本运行的域请求数据。例如,如果你正在运行脚本www.example.com/script.js,那么你可以在www.exaple.com域下,只有阿贾克斯的文件,而不是www.facebook.com。
You are not allowed to request data from other sites than the domain the script is running on. For example, if you are running the script www.example.com/script.js, then you can only ajax files under the www.exaple.com domain, not www.facebook.com.
有几种方法可以做到这一点:
There are a few ways to do it:
- JSONP 是一种方式,但它要求 Facebook的回复与JSONP数据。不 知道它。在这里 JSONP 更多信息。
- CSSHtt prequest (或AJACSS)是另一种方式。严重怀疑facbook使用此方法。
- JSONp is a way, but it requires that facebook replies with jsonp data. Not sure if it does. More info on JSONp here.
- CSSHttpRequest (or AJACSS) is another way. Seriously doubt facbook uses this method.
这篇关于jQuery的阿贾克斯不工作的Facebook应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!