问题描述
我正在尝试创建一个Facebook应用程序,一切正常,除了我正在使用的ajax部分从第一个选择框中选择的项目填充第二个框。
我正在使用jquery(v1.3.2)来完成这个。这个ajax在主机上工作得很好,我已经占用了空间,但是它在Facebook上不起作用。
这是我关于这个问题的问题, / p>
- 画布页面的url需要与我的应用程序名称相同。 (在我的情况下是不同的)
我在facebook的父选择框的onchange事件上收到此错误。 >
- 什么可能是错的?请帮我解决这个问题。
谢谢
您不允许从脚本运行的域请求其他站点的数据。例如,如果您正在运行脚本www.example.com/script.js,那么您只能在www.exaple.com域下的ajax文件,而不是www.facebook.com。
有几种方法可以实现:
- 是一种方式,但它要求
Facebook回复jsonp数据。不是
肯定如果它。关于JSONp的更多信息。 - (或AJACSS)是另一种方式。严重怀疑facbook使用这种方法。
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.
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,
- does canvas page url needs to be same as that of my application name. ( in my case it is different)
I am getting this error on the onchange event of parent select box inside facebook.
- what might be wrong...? Please help me solve this problem.
Thanks
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 is a way, but it requires thatfacebook replies with jsonp data. Notsure if it does. More info on JSONp here.
- CSSHttpRequest (or AJACSS) is another way. Seriously doubt facbook uses this method.
这篇关于jquery的ajax不能在Facebook应用程序中工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!