You can use Ajax for this solution. When you place a PHP function getYoutubeDurationV3in a file .php.
$(document).ready(function() {
$("#btn_url").on('click', function() {
var video_val = $("#video_url").val(); alert(video_val);
$.ajax({
url: 'yourphpscript.php',
data: {duration: video_val},
type: 'POST',
success: function(data) {
alert(data);
}
});
});
});
And in your PHP file, you can get a value similar to this:
<?php
$duration = $_POST['video_val'];
return $response;
?>
source
share