Execute file instead of redirect

-1

I have the following javascript:

$(".enviar_email").click(function(){
    $('#myModal').modal('hide');
    window.location.href = "<? echo base_url('boleto/email/'); ?>/" + cliente + "/" + datainicial + "/" + datafinal;    
}); 

I need to click, do not redirect, just run the url. Without redirecting, how do I?

    
asked by anonymous 18.06.2016 / 23:24

1 answer

2

I found a solution, I leave it registered for whoever serves!

$(".enviar_email").on("click", function(evt) {
    $.ajax({
        url: "<? echo base_url('boleto/email/'); ?>/" + cliente + "/" + datainicial + "/" + datafinal,
        data: {id: 1 },
        type: 'BOLETO'
    }).done(function() {
         $('#myModal').modal('hide');
         $('#myModalBoletoOK').modal('show');
    });
});

In this case, run the URL and show the "Boleto sent" message (in my case)

    
19.06.2016 / 02:26