function DateValid() { $(".running").removeClass("running") if ( $(this).parent(".locomotive-wrap-traffic").parent(".flex").children(".locomotive-game-text").children(".locomotive-otvet-false").hasClass("active") || $(this).parent(".locomotive-wrap-traffic").parent(".flex").children(".locomotive-game-text").children(".locomotive-true").hasClass("disabled")) { $(".locomotive-false").addClass("defeat") $(".locomotive-user").addClass("defeat") setTimeout(function () { TrueDATA = $(this).parent(".locomotive-wrap-traffic").parent(".flex").children(".locomotive-game-text").data("truetext") alert(TrueDATA);//Тут выводится ОК DefeatPage(TrueDATA) $(".running").addClass("running") },5000) } else { $(".locomotive-user").addClass("active") setTimeout(function () { TrueDATA = $(this).parent(".locomotive-wrap-traffic").parent(".flex").children(".locomotive-game-text").data("truetext") WinPage() $(".running").addClass("running") },5000) } } function DefeatPage(param) { alert(param);// тут undefined $(".locomotive-start").hide() $(".locomotive-result-win").hide() $(".locomotive-game-wrap").hide() $(".locomotive-game-wrap .flex").hide() $(".locomotive-rule").hide() $(".locomotive-game").show() $(".locomotive-result-lose").show() $(".locomotive-otvet-false").removeClass("active") $(".locomotive-true").removeClass("active") $(".locomotive-false").removeClass("defeat") $(".locomotive-user").removeClass("defeat") $("#reuslt-text").html(param) AppStatus = "defeat" } |