Deleting decks reloads list of decks.

This commit is contained in:
marcins78@gmail.com
2011-12-14 14:08:08 +00:00
parent 58a1895c84
commit 4d7a95c68e
2 changed files with 12 additions and 8 deletions

View File

@@ -185,7 +185,7 @@ var GempLotrCommunication = Class.extend({
dataType: "xml" dataType: "xml"
}); });
}, },
deleteDeck: function(deckName) { deleteDeck: function(deckName, callback) {
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: this.url + "/deck/delete", url: this.url + "/deck/delete",
@@ -193,6 +193,7 @@ var GempLotrCommunication = Class.extend({
data: { data: {
participantId: getUrlParam("participantId"), participantId: getUrlParam("participantId"),
deckName: deckName}, deckName: deckName},
success: callback,
error: this.failure, error: this.failure,
dataType: "xml" dataType: "xml"
}); });

View File

@@ -121,7 +121,10 @@ var GempLotrDeckBuildingUI = Class.extend({
function() { function() {
if (confirm("Are you sure you want to delete this deck?")) { if (confirm("Are you sure you want to delete this deck?")) {
if (that.deckName != null) if (that.deckName != null)
that.comm.deleteDeck(that.deckName); that.comm.deleteDeck(that.deckName,
function() {
that.loadDecks();
});
that.deckName = null; that.deckName = null;
$("#editingDeck").html("Editing deck: New deck"); $("#editingDeck").html("Editing deck: New deck");
that.clearDeck(); that.clearDeck();