Run file instead of redirect

Asked

Viewed 30 times

-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 that when clicking, do not redirect, just run the url. No redirect, how do I?

  • The URL returns some data?

  • No, because I do an execution on it in the background only...

  • Ajax wouldn’t be the way?

1 answer

2

I found a solution, I leave it on record to whom to serve!

$(".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 display the "Boleto sent" message (in my case)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.