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.

Access to restricted URI denied" code: "1012

  • what might be wrong...? Please help me solve this problem.

Thanks

Comments

What kind of Facebook application is it? FBML or IFrame?

Written by zombat

What's CakePHP got to do with this?

Written by mgroves

well, it is an iframe application, and for the second comment the application has been built in cakephp.

Written by Gaurav Sharma

Accepted Answer

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 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.
Written by Marius
This page was build to provide you fast access to the question and the direct accepted answer.
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki