0
我想在調用Ajax之後重新加載我的頁面。它適用於location.reload(),但我重定向到第一個選項卡。我怎樣才能重新加載我的標籤?在調用ajax之後重新載入特定的選項卡
HTML
<div class="tabs">
<a class="tab" data-target="#profile">
<h3 class="tab-title active" data-target="#profile">Mes informations</h3>
</a>
<a class="tab" data-target="#prayers">
<h3 class="tab-title" data-target="#prayers">Mes prières</h3>
</a>
<a class="tab" data-target="#pains" id="tab-pains">
<% if (@notification && @notification.count > 0) %>
<h3 class="tab-title" data-target="#pains">Mes demandes <span id="tab-notification">(<%= @notification.count %>)</span></h3>
<% else %>
<h3 class="tab-title" data-target="#pains">Mes demandes </h3>
<% end %>
</a>
</div>
JQuery的
$(document).ready(function() {
$(".user-show-delete").on("click", function(e){
var id = $(this).data("id");
var pain_id = $(this).data("id-pain");
console.log(id)
console.log(pain_id)
var current_index = $("#tabs").tabs("option","active");
swal ({
title: 'Effacer',
text: 'Voulez-vous supprimer cette prière ?',
type: 'question',
showCancelButton: true,
confirmButtonColor: '#B56969',
cancelButtonColor: '#B4D8C0',
confirmButtonText: 'Oui',
cancelButtonText: 'Non'
}).then(function() {
$.ajax({
type: 'DELETE',
url: '/pains/' + pain_id + '/prayers/' + id,
success: location.reload(),
});
});
});
});
謝謝您的回答