S
S
Sergey Zaigraev2017-01-27 10:53:29
PHP
Sergey Zaigraev, 2017-01-27 10:53:29

Bitrix. Modal login form not loading?

Modal windows are implemented on the site using the jqModal plugin, below is the code section that initializes the login form:

$('.'+name+'_frame').jqm({
          trigger: open_trigger,
          onLoad: function( hash ){
          onLoadjqm( name , hash , requestData, selector); },
          ajax: arMShopOptions["SITE_DIR"]+'ajax/auth.php'
   });

i.e. the element is searched where $('.form_frame') checked, all parameters are passed normally. Below is the jqm call code:
$(document).ready(function(){
            jqmEd('enter', 'auth', '.avtorization-call.enter');
        });

jqmEd - wrapper function, it accepts only additional parameters.
Here is the code of the auth.php file to which the request is made:
<?require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php");?>
<?
global $USER;

if($_GET["auth_service_error"]){
    LocalRedirect(SITE_DIR.'auth/');
}
if(!$USER->IsAuthorized()){?>
    <div id="wrap_ajax_auth">
        <a href="#" class="close jqmClose"><i></i></a>
        <div class="popup-intro">
            <div class="pop-up-title">Вход в личный кабинет</div>
        </div>
        <?
        $APPLICATION->IncludeComponent(
            "bitrix:system.auth.form",
            "mshop",
            Array(
                "REGISTER_URL" => SITE_DIR."auth/registration/",
                "PROFILE_URL" => SITE_DIR."personal/",
                "FORGOT_PASSWORD_URL" => SITE_DIR."auth/forgot-password/",
                "AUTH_URL" => SITE_DIR."ajax/show_auth_popup.php",
                "SHOW_ERRORS" => "Y",
                "POPUP_AUTH" => "Y",
                "AJAX_MODE" => "Y"
            )
        );?>
    </div>
<?}
elseif(strlen($_REQUEST["backurl"])){
    LocalRedirect($_REQUEST["backurl"]);
}
else{
    if(strpos($_SERVER['HTTP_REFERER'], '/auth/') === false && strpos($_SERVER['HTTP_REFERER'], '/ajax/auth.php') === false){
        $APPLICATION->ShowHead();
        ?>
        <script>
            jsAjaxUtil.ShowLocalWaitWindow( 'id', 'wrap_ajax_auth', true );
            BX.reload(false)
        </script>
        <?
    }
    else{
        LocalRedirect(SITE_DIR.'personal/');
    }
}

and when we click on the element, the form pops up empty, i.e. the data from auth.php is not inserted. If you try to load another file, for example test.php with the hello test, then everything works fine, the text is displayed in the modal window. But once you connect
<?require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php");?>
then emptiness is loaded, i.e. there is nothing.
Tell me what could be wrong? Interestingly, on another site, a similar code works fine.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question