Ajax request for cross domain from javascript without server side code

I use the random.org service (I want to get numbers from random.org using the URL). I am extracting data using ajax from my JavaScript. So how to make cross domain ajax call from my domain (and avoid permission error)? I want a solution without the help of server code (sever proxy). Sample code will be a big help for me.

+2
source share
3 answers

Lobbying the owner of random.org to provide the jsonp API is the only way to do this.

+7
source

Just sent an email to random.org and got this response

Thank you for your email address. Yes, I am working on a JSONP interface.

Respectfully,

Mads

+3
source

You need a proxy server on your domain, otherwise this will not happen. Here's a summary of cross-domain ajax methods, the only "real" non-proxy solution, as RichieHindle, jsonp noted . But this requires you to be friends with guys on a random site or for them to have a good reason to include it for you.

+1
source

Source: https://habr.com/ru/post/888308/


All Articles