Доброго времени суток!
Пытаюсь сделать открытие формы в попап окне, но при клике на ссылку в консоли ошибка Uncaught TypeError: Cannot read property 'createDocumentFragment' of null
Помогите, пожалуйста, разобраться. Спасибо.
Форма
<div id="appFastBuy" data-load="<?=SITE_TEMPLATE_PATH?>/images/picLoad.gif">
<div id="appFastBuyContainer">
<div class="heading">Купить в один клик <a href="#" class="close closeWindow"></a></div>
<div class="container" id="fastBuyOpenContainer">
<div class="column">
<div id="fastBuyPicture"><a href="#" class="url"><img src="<?=SITE_TEMPLATE_PATH?>/images/picLoad.gif" alt="" class="picture"></a></div>
<div id="fastBuyName"><a href="<?=$_COOKIE['URI']?>" class="name url"><span class="middle"></span></a></div>
<div id="fastBuyPrice" class="price"></div>
</div>
<div class="column">
<div class="title">Заполните данные для заказа</div>
<form action="<?=SITE_DIR?>callback/" id="fastBuyForm" method="GET">
<input name="id" type="hidden" id="fastBuyFormId" value="">
<input name="act" type="hidden" id="fastBuyFormAct" value="fastBack">
<input name="SITE_ID" type="hidden" id="fastBuyFormSiteId" value="<?=SITE_ID?>">
<div class="formLine"><input name="name" type="text" placeholder="Имя*" value="" id="fastBuyFormName"></div>
<div class="formLine"><input name="phone" type="text" placeholder="Телефон*" value="" id="fastBuyFormTelephone"></div>
<div class="formLine"><textarea name="message" cols="30" rows="10" placeholder="Сообщение" id="fastBuyFormMessage"></textarea></div>
<div class="formLine"><input type="checkbox" name="personalInfoFastBuy" id="personalInfoFastBuy"><label for="personalInfoFastBuy">Я согласен на <a href="/personal-info/" class="pilink">обработку персональных данных.</a>*</label></div>
<div class="formLine"><a href="#" id="fastBuyFormSubmit"><img src="<?=SITE_TEMPLATE_PATH?>/images/incart.png" alt="Купить в один клик"> Купить в один клик</a></div>
</form>
</div>
</div>
<div id="fastBuyResult">
<div id="fastBuyResultTitle"></div>
<div id="fastBuyResultMessage"></div>
<!--<a href="" id="fastBuyResultClose" class="closeWindow">Закрыть окно</a>-->
<span id="fastBuyResultClose" class="closeWindow">Закрыть окно</span>
</div>
</div>
</div>
Ссылка
<a href="#" class="fastBack label changeID<?if(empty($arResult["PRICE"]) || $arResult["CATALOG_AVAILABLE"] != "Y"):?> disabled<?endif;?>" data-id="<?=$arResult["ID"]?>"><?=GetMessage("FASTBACK_LABEL")?>1 клик</a>
Скрипт
var fastBuyOpen = false;
$(document).load("ready", function(event) {
console.log(fastBuyOpen);
/*var $body = $("body").removeClass("loading"); // cache body
var $window = $(window);*/
var openFastBack = function (event) {
var $this = $(this);
if ($this.hasClass("disabled")) {
var $appFastBuy = $("#appFastBuy");
var $foundation = $("#foundation").addClass("blurred");
$("#fastBuyOpenContainer").show();
$("#fastBuyResult").hide();
$("#fastBuyForm").find('input[type="text"], textarea').val("");
var productID = $this.data("id");
$this.addClass("loading");
var gObj = {
id: productID,
act: "getFastBuy"
};
console.log(gObj);
$.getJSON(ajaxPath, gObj).done(function (jData) {
$this.removeClass("loading");
$appFastBuy.find("#fastBuyPicture .url, #fastBuyName .url").attr("href", jData[0]["DETAIL_PAGE_URL"]);
$appFastBuy.find("#fastBuyPicture .picture").attr("src", $appFastBuy.data("load"));
$appFastBuy.find("#fastBuyPrice").html(jData[0]["PRICE"]["PRICE_FORMATED"]);
$appFastBuy.find("#fastBuyName .middle").html(jData[0]["NAME"]);
$appFastBuy.find("#fastBuyFormId").val(jData[0]["ID"]);
$appFastBuy.find(".markerContainer").remove();
if (jData[0]["MARKER"] != undefined) {
$appFastBuy.find("#fastBuyPicture").prepend(
$("<div>").addClass("markerContainer")
.append(
jData[0]["MARKER"]
)
);
}
$appFastBuy.show();
loadingPictureControl(jData[0]["PICTURE"]["src"], function () {
$appFastBuy.find("#fastBuyPicture .picture").attr("src", jData[0]["PICTURE"]["src"]);
});
}).fail(function (jqxhr, textStatus, error) {
$.get(ajaxPath, gObj).done(function (Data) {
console.log(Data)
});
$this.removeClass("loading")
.addClass("error");
console.error(
"Request Failed: " + textStatus + ", " + error
);
});
fastBuyOpen = true;
}
return event.preventDefault();
};
var sendFastBack = function(event){
var $this = $(this).addClass("loading");
var $fastBuyForm = $("#fastBuyForm");
var $fastBuyFormName = $fastBuyForm.find("#fastBuyFormName").removeClass("error");
var $fastBuyFormTelephone = $fastBuyForm.find("#fastBuyFormTelephone").removeClass("error");
if($fastBuyFormName.val() == ""){
$fastBuyFormName.addClass("error");
}
if($fastBuyFormTelephone.val() == ""){
$fastBuyFormTelephone.addClass("error");
}
var $personalInfo = $fastBuyForm.find("#personalInfoFastBuy");
if(!$personalInfo.prop("checked")){
$personalInfo.addClass("error");
}
if($fastBuyFormName.val() != "" && $fastBuyFormTelephone.val() !="" && $personalInfo.prop("checked")){
$.getJSON(ajaxPath + "?" + $fastBuyForm.serialize()).done(function(jData){
//metrica
if(typeof globalSettings != "undefined" && typeof globalSettings["TEMPLATE_METRICA_FAST_BUY"] != "undefined" && typeof globalSettings["TEMPLATE_METRICA_ID"] != "undefined"){
window["yaCounter" + globalSettings["TEMPLATE_METRICA_ID"]].reachGoal(globalSettings["TEMPLATE_METRICA_FAST_BUY"]);
}
$("#fastBuyResultTitle").html(jData["heading"]);
$("#fastBuyResultMessage").html(jData["message"]);
$("#fastBuyOpenContainer").hide();
$("#fastBuyResult").show();
$this.removeClass("loading");
}).fail(function(jqxhr, textStatus, error){
$this.removeClass("loading").addClass("error");
console.error(
"Request Failed: " + textStatus + ", " + error
);
});
}else{
$this.removeClass("loading");
}
return event.preventDefault();
};
var closeFastBack = function (event) {
var $appFastBuy = $("#appFastBuy").hide();
var $foundation = $("#foundation").removeClass("blurred");
return event.preventDefault();
};
$(document).on("click", ".fastBack", openFastBack);
$(document).on("click", "#appFastBuy .closeWindow", closeFastBack);
});