Tengo un problema, al momento de enviar y registrar en la bd una venta me envía un mensaje de confirmación y eso lo muestro en pantalla:
Este código captura el submit y recibe el mensaje:
$ (".frm-ventas").submit(function(event) { event.preventDefault(); var url = $ (this).attr('action'); var data = $ (this).serialize(); $ .ajax({ type:'POST', dataType:'json', url:url, data:data, success:function(response){ $ ('#caja').toggle(); $ ("span").remove( ".mensaje" ); $ ("i").remove('.glyphicon'); $ ("#caja").fadeOut(5000); if (response.respuesta == true) { $ (".box-pago").hide(); setTimeout(function(){ window.open("example/report/factura.php?invoice=reponse.invoice"); }, 5000); // 5000 ms $ ('#caja').removeClass('alert-danger').addClass('alert-info'); $ ("#caja").append("<i class='glyphicon glyphicon-info-sign' aria-hidden='true'></i>"); $ ("#caja").append("<span class='mensaje'>"+" ok: "+response.mensaje+"</span>"); $ ('.cargando').toggle(); $ ('.cargando p').html('Limpiando el carrito...'); setTimeout(llenar_tabla_json, 2000); limpiarformulario($ (".frm-ventas")); }else{ $ ('#caja').removeClass('alert-info').addClass('alert-danger'); $ ("#caja").append("<i class='glyphicon glyphicon-exclamation-sign' aria-hidden='true'></i>"); $ ("#caja").append("<span class='mensaje'>"+" Error: "+response.mensaje+"</span>"); } },error:function(){ alert("Ha ocurrido un error"); } }); });
Y este es el mensaje:
$ salidaJson=array('respuesta' => $ mensajeOk,'mensaje' => $ mensajeError, 'invoice' => $ invoice); echo json_encode($ salidaJson);
Quiero abrir esa pagina con window.open
y enviarle la variable $ invoice
intente con este código y nada
window.open("example/report/factura.php?invoice=reponse.invoice");
Alguna idea ?