How can I asynchronously put the new url in the ajax call? I've tried a few changes but they don't work. Currently code is:
<!-- Input form -->
<form class="navbar-form navbar-left" role="search" id="formversion">
  <div class="form-group">
    <input type="text" id= "version_number" class="form-control" placeholder="Place version number">
  </div>
</form>
I want to get the input value, my .js file: var version_picked = $("#version_number").val();
I want to use this version_picked string in a function similar to the next [full code]:
var defau;
var version_picked;
$(document).ready(function(){
    $('#formversion').on('submit', function() {
        version_picked = $("#version_number").val(); 
        defau = version_picked;
        console.log("here",defau);
        return false;
    });
    var p1 = $.ajax({
        "url":"https://www.blabla.com/api/6/61fq8sx8?",
        "crossDomain":true,
        "dataType":"jsonp",
    });
    var p2 = $.ajax({
        "url":"https://www.blabla.com/api/" + defau + "/61fq8sx8?",
        "crossDomain":true,
        "dataType":"jsonp",
    });
    Promise.all([p1,p2])
    .then(function(results){
        // console.log(results[1]); //Sat Jan 16 2016 07:12:47 GMT+0000 (UTC)
        var thisversion = results[1].version; //get the version of the second url/column
        var res_today = results[0].results;
        var res_otherdate = results[1].results;
        var date_today = res_today.collection1[0].date;
        var date_other = res_otherdate.collection1[0].date;
        var collection_today = results[0].results.collection2;
        var collection_otherdate = results[1].results.collection2;
        $(".table-group1").append('<tr>'+'<td class=well"></td>'+ 
            '<td class=well">'+ date_today.substr(56,60) +'</td>'+ 
            '<td class=well">' + date_other.substr(56,60) +'</td>' + 
            '<td class=well">'+ "DNS_1" +'</td>' + 
            '<td class=well">'+ "DNS_2" +'</td>' + 
            '<td class=well">'+ "Mail_1" +'</td>'+
            '<td class=well">'+ "Mail_2" +'</td>'+
            '<td class=well">'+ "Web_1" +'</td>' + 
            '<td class=well">'+ "Web_2" +'</td>' + '</tr>');
        for (var i = 1; i < collection_otherdate.length; i++){ 
            $(".table-group1").append('<tr>' + '<td class="well">' + i + '</td>' +'<td class="well">' + collection_today[i].domain.href + '</td>' + '<td class="well" id="domain1">' + 
                collection_otherdate[i].domain.href + '</td>'+ '<td class="well" >' + collection_today[i].dns + '</td>' + '<td class="well">' + 
            collection_otherdate[i].dns + '</td>' + '<td class="well">' +
            collection_today[i].mail + '</td>' + '<td class="well">' + 
            collection_otherdate[i].mail + '</td>' + '<td class="well">' + 
            collection_today[i].web + '</td>' +  '<td class="well">' +
            collection_otherdate[i].web + '</td>' +'</tr>');     
        }
    })
});
 
    