I need to reload my principal page after close iframe. I use jquery to open modal and .html() to add iframe html parameters.
This open when I do click on my id a href="#ex2"
<div><a href="#ex2" rel="modal:open" >Prueba de Maquillaje</a></div>
This call my funcion and add the iframe on my id idcart
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<!-- jQuery Modal -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-modal/0.9.1/jquery.modal.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-modal/0.9.1/jquery.modal.min.css" />
<script>
$('.close-modal ').click(function() {
location.reload();
});
var requestOptions = {method:'GET', redirect:'follow'};
fetch("https://modiface--locatelcolombia.myvtex.com/api/checkout/pub/orderForm/", requestOptions)
.then(response => response.json())
.then(function(r) {
cartId = r['orderFormId'];
$("#idCart").html("<iframe src='http://localhost:81/proyectoModiface/modiface/index.php?cartId="+cartId+"' class='frameModiface' id='pruebasId' allow='camera' name='iframe_a'></iframe>");
});
</script>```
This is my idCart div id
``` <div id="ex2" class="modal"><div id="idCart"></div></div>```