programmers-proverbs icon indicating copy to clipboard operation
programmers-proverbs copied to clipboard

Can't access random through Ajax

Open ikedumancas opened this issue 9 years ago • 3 comments

How can I access the random proverb generator through ajax? I'm having a No 'Access -Control-Allow-Origin' error.

ikedumancas avatar Jul 26 '15 05:07 ikedumancas

This can be fixed by allowing CORS on the server which can only be configure by @AntJanus. If that's impossible, another way is to setup a proxy on your server that will make a request to the generator and use it on your ajax request.

christianesperar avatar Aug 04 '15 17:08 christianesperar

I'll go ahead and get that setup! I'll update when I'm done.

AntJanus avatar Aug 05 '15 15:08 AntJanus

Another solution is jsonp but the output must be on json to avoid some error.

christianesperar avatar Aug 06 '15 05:08 christianesperar