I am having trouble querying a random number from random.org using jQuery. When I use a static page and the following javascript, I have no problem getting random numbers. However, I accept the Sinatra application on Heroku (also when I launch my application locally using Thin) I get "(website) Access-Control-Allow-Origin is not allowed."
function raffler(){
var rowCount = $('#winnerTable tr').length;
$('#winnerButton').click(function() {
$.get("http://www.random.org/integers/?", {num: "1", min: "1", max: rowCount, col: "1", base: "10", format: "plain", rnd: "new"}, function(randNum) {
var myNumber = randNum;
$("#entry-" + randNum).addClass('winner');
});
});
};
Thoughts?
source
share