<!doctype html>
<html lang="ru">
<body>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script type="text/javascript">
jQuery(document).ready(function() {
$(document).on('click', '#import_btn', function() {
$('#result').html('');
var error = false;
var title = $("#title").val();
if (title == '' || title == null) {
error = true;
}
var lang = $("#lang option:selected").val();
if (!error) {
$.ajax({
type: 'POST',
url: 'https://ahoy.yohoho.online?cache'+ Math.random().toString().substr(2, 3),
data: {
"title": title,
"player": 'collaps',
},
dataType: 'json',
beforeSend: function() {
$("#button-area").html('<button class="btn btn-primary" type="button" disabled><span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>Loading...</button>');
//$("#import_btn").html('.....');
},
success: function(response) {
var url = response.collaps.iframe;
console.log(url);
document.getElementById("url").innerHTML = url;
}
});
}
});
});
</script>
<form method="post">
<input type="text" class="form-control" id="title" aria-describedby="button-addon2" value="Ариэль"><br>
<button class="btn btn-outline-primary" id="import_btn" type="button">FETCH</button>
</form>
<pre id="url"></pre>
</body>
</html>