$(function(){
|
|
|
|
$(".new-player-twitter-btn").click(function(){
|
|
$(this).addClass("disabled");
|
|
var btn = $(this);
|
|
|
|
$.post("/teams/add-player", {
|
|
team: $(this).siblings(".new-player-twitter").data("team"),
|
|
twitter: $(this).siblings(".new-player-twitter").val()
|
|
}, function(response){
|
|
btn.removeClass("disabled");
|
|
if(response.error) {
|
|
btn.parent().addClass("has-error");
|
|
} else {
|
|
window.location.reload();
|
|
}
|
|
});
|
|
|
|
return false;
|
|
});
|
|
|
|
$("#add-team").click(function(){
|
|
$(this).addClass("disabled");
|
|
|
|
$.post("/teams/new", {
|
|
}, function(response){
|
|
window.location.reload();
|
|
});
|
|
});
|
|
|
|
});
|