From 415a166e7d3e169af868b4b04537e9a3ecec011b Mon Sep 17 00:00:00 2001 From: "marcins78@gmail.com" Date: Fri, 6 Apr 2012 16:14:28 +0000 Subject: [PATCH] Fixing joining JS code. --- .../src/main/webapp/js/leagueResultsUi.js | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/leagueResultsUi.js b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/leagueResultsUi.js index acc0b20b1..2541527d2 100644 --- a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/leagueResultsUi.js +++ b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/leagueResultsUi.js @@ -61,15 +61,19 @@ var LeagueResultsUI = Class.extend({ $("#leagueResults").append("
You are already a member of this league.
"); else if (joinable == "true") { var joinBut = $("").button(); - joinBut.click( - function() { - that.displayBuyAction("Do you want to join the league by paying " + costStr + "?", - function() { - that.communication.joinLeague(leagueType, function() { - that.loadResults(); - }); + + var joinFunc = (function(leagueCode, costString) { + return function() { + that.displayBuyAction("Do you want to join the league by paying " + costString + "?", + function() { + that.communication.joinLeague(leagueCode, function() { + that.loadResults(); }); - }); + }); + }; + })(leagueType, costStr); + + joinBut.click(joinFunc); var joinDiv = $("
You're not a member of this league.
"); joinDiv.append(joinBut); $("#leagueResults").append(joinDiv);