Q:

Parsing Random.org data to an int in JS

I have a little web app I'm using to test out CSS animations. I've got it working but I want more true randomness, so I'm trying to draw from Random.org. How can I take the result from Random.org into a JavaScript variable and use it as an int?

A:

You use $.ajax to load the site, then parseInt(x) and pass that to a function to handle the randomness.
For example:
$.ajax({
    "type": "GET",
    "url": "http://www.random.org/integers/?num=1&min=1&max=6&col=1&base=10&format=plain&rnd=new",
    "success": function( data, status, xhr ){
         send_the_number_to_a_handler( parseInt( data ) );
    }
});

