I would like to print "redirect url" in modal as a result of receiving from curl after submit on the same page. What should I do?
in this submit form code
<form method="post" id="kakao_pay" action="">
<input type="text" name="item_name" class="form-control"/>
</form>
in this curl code
if ($status_code == 200) {
$output_arr = json_decode($output, true);
$page = $output_arr['next_redirect_pc_url'];
echo "
<script>window.open('$page' , 'payviewer', 'width=450,height=500' );</script>
";
}
I want "window.open('$page' , 'payviewer', 'width=450,height=500' );" change modal.
How to change?
I am adding HTML & PHP Code. Update it according to your desired requirement.
HTML CODE:
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
<form method="post" id="kakao_pay" action="">
<input type="text" name="item_name" class="form-control"/>
</form>
<div class="modal fade" id="myModal" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Modal Header</h4>
</div>
<div class="modal-body">
<iframe id="iframe_modal" src="" style="width: 100%; height: 40%;"></iframe>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
PHP CODE:
<?php
$status_code = 200;
if ($status_code == 200)
{
$page = "https://www.youtube.com/embed/d7sewLjzNs0";
?>
<script>
var url = "<?php echo $page; ?>";
$("#iframe_modal").attr("src", url);
$('#myModal').modal('show');
</script>
<?php
}
?>