jquery 的 ajax 在 facebook 应用程序中不起作用 [英] jquery's ajax not working in facebook apps

查看:29
本文介绍了jquery 的 ajax 在 facebook 应用程序中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个 facebook 应用程序,除了我用来从第一个选择框中选择的项目中填充第二个框的 ajax 部分外,一切正常.

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 被拒绝"代码:1012

Access to restricted URI denied" code: "1012

  • 可能有什么问题...?请帮我解决这个问题.
  • 谢谢

    推荐答案

    除了运行脚本的域之外,您不能从其他站点请求数据.例如,如果您正在运行脚本 www.example.com/script.js,那么您只能在 www.exaple.com 域下的 ajax 文件,而不是 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.

    有几种方法可以做到:

    • JSONp 是一种方法,但它要求facebook 回复 jsonp 数据.不是确定是否可以.有关 JSONp 的更多信息此处.
    • CSSHttpRequest(或 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 的 ajax 在 facebook 应用程序中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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