You must bear in mind that when you use dropdown-toggle
bootstrap it cancels the default behaviors of the elements, in this case of the <a>
tag, then what you could do is send the variables to the required file using window.open()
$(function(){
$("#btn_envio").click(function(){
var primerFecha = $(".primerFecha").val();
var segundaFecha = $(".segundaFecha").val();
if (primerFecha != '' && segundaFecha != ''){
window.open("report/resumenventas.php?fecInicio=" + primerFecha + "&fecFinal=" + segundaFecha, "_blank")
}else{
alert('Faltan campos por llenar');
}
});
});
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<input type="text" class="primerFecha" name="">
<input type="text" class="segundaFecha" name="">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" id="btn_envio">
<a id="reporteBV" target="_blank" href="#">envio</a>
</button>
Note: SOes snippet does not work window.open()
but when you do it in your local environment it will work for you.