views:

48

answers:

2

Hi all,
i'm trying to make a test with ajax response using an external array as a config file...

But it isn't working, i'm getting always a blank response...
Can anyone point me the reason?

Here is the link of jsBin test: http://jsbin.com/udanu/2/edit

+5  A: 

It looks like you have bumped into the Same Origin Policy. You cannot make Ajax requests to hosts outside your domain, unless you use JSONP, or some other technique to get around the policy.

You may want to check out the following Stack Overflow post for a few popular solutions to work around the SOP (mainly the JSONP, CORS and Reverse Proxy methods):

Daniel Vassallo
How can i resolve it?
CuSS
@CuSS: I've updated my answer with a link which you may find interesting.
Daniel Vassallo
i'm trying correcting with: header("Access-Control-Allow-Methods: POST"); AND header("Access-Control-Allow-Origin: *"); but they aren't working
CuSS
@CuSS: Maybe you'd want to post a new question on this. I don't have much experience with CORS, but I'm sure others on Stack Overflow do.
Daniel Vassallo
+1  A: 

As you are trying to get data from another domain, maybe you should try using "jsonp" instead of "text" as a dataType.

EDIT: didn't see the previous answer.

PJP