Silent Warrior
Silent Warrior

Reputation: 5285

Cross domain ajax request from javascript file without help of server side code

I am consuming service of random.org, (I want to get the numbers from random.org site using url). I am fetching data using ajax from my JavaScript. So how to make cross domain ajax call from my domain (and avoid permission error)? I want solution without help of server side code (sever proxy). Example code will be great help for me.

Upvotes: 2

Views: 592

Answers (3)

mplungjan
mplungjan

Reputation: 178413

Just sent an email to random.org and received this reply

Thanks for your email. Yes, I am working on a JSONP interface.

Best regards,

Mads

Upvotes: 3

karim79
karim79

Reputation: 342765

You need a server proxy on your domain, or it won't happen. Here's a summary of cross-domain ajax techniques, the only 'real' non-proxy solution, as RichieHindle pointed out, being jsonp. But that requires you to be buddies with the guys at random.org, or for them to have a compelling reason to enable it for you.

Upvotes: 1

RichieHindle
RichieHindle

Reputation: 281835

Lobby the owner of random.org to provide a jsonp API - that's the only way to make this happen.

Upvotes: 7

Related Questions