How to logout in the frontend?

Normally in all E Commerce systems exists any way the customer close his session, but I don´t find nothing... although i found this method:

vtexjs.checkout.getOrderForm()

.then(function(orderForm) {

var logoutURL = vtexjs.checkout.getLogoutURL();

window.location = logoutURL;

});

But the system redirects to the checkout page, and I do not want this, I want the client to stay on the current page.

Anybody knows any way to do this?? Thank you!

Try something like this:

$.ajax({ url: "/no-cache/user/logout" }).done(function(){ window.location = "/"; });