При закрытии всплывающего окна появляется ошибка javascript: «Uncaught ReferenceError: require is notfined» *
в строке: require(["model/register"], function (registerModel) {
Полный код:
function fbConnect(thepath) {
//var thepath = window.location.protocol +'//'+ window.location.hostname+'/?';
console.log('path: ' + thepath );
var self = this;
self.popupWindow = window.socialPopupWindow = window.open(
thepath,
"hybridauth_social_sing_on",
"location=0,status=0,scrollbars=0,width=800,height=500"
);
var winTimer = setInterval(function ()
{
console.log('a ');
if (self.popupWindow.closed !== false)
{
console.log('b ');
// !== is required for compatibility with Opera
clearInterval(winTimer);
console.log('c ');
//Now twitter register from
require(["model/register"], function (registerModel) {
console.log('d ');
var registerM = new registerModel();
var ajaxRequest = registerM.socialRegister();
$.when(ajaxRequest).done(function (response) {
console.log(response);
self.slideOutRegister("Twitter");
self.twitterObject = response;
$('#reg_user').val(response.firstName);
});
$.when(ajaxRequest).fail(function () {
self.slideOutRegister("Email");
});
});
}
}, 200);
}
[Код выше фактически взят из { ссылка }]