JSFiddle - React, Tailwind, and code Playground

by georgie

HTML

<form>
    <input type='text' placeholder='max' class='maxValueField' value='1712'/>
    <br>
        <textarea class='resultField'></textarea>
     <input type='submit' value='refresh'/>
 </form>

CSS

textarea{
    width: 300px;
    height: 300px;
}

JavaScript

$('form').submit(function(e){
    e.preventDefault();
        
    maxValue = $('.maxValueField').val();
    url = "https://www.random.org/integer-sets/?sets=1&min=0&max="+maxValue+"&seqnos=off&commas=off&order=index&num=24&base=10&format=plain&rnd=new"

    $.get(url).done(function(data,status){
        val = data.replace(/^[.\s]+|[.\s]+$/g, "").replace(/\s{2,}/g, ' ').replace(/\s{1,}/g, ',');
        $(".resultField").val(val)
    });
    console.log('go');
});