Удалить или заблокировать команду $ .ajax - url: "global-functions.php - PullRequest
0 голосов
/ 15 октября 2019

Мне нужна помощь с одним шаблоном. Мне нужно удалить или заблокировать действие / функцию (global-functions.php), потому что некоторые опции в шаблоне не работают. Вы можете увидеть код JS ниже.

$("#regLoginNewUser").submit(function (event){event.preventDefault();var data=$(this).serialize();$.ajax({url:"global-functions.php",type:"POST",data:data,success:function(response){setTimeout(function(){alertify.success('Login successfully');},1000);setTimeout(function(){location.reload();},2000);}});});

Здесь вы можете увидеть код из файла HTML (index.html), у кого-нибудь есть решение для этого? Я пытаюсь некоторые команды, чтобы заблокировать эти коды, что-то вроде: // $ .ajax и другие, но не работает. Спасибо

<script type="text/javascript">
    new WOW().init();
      var user = '';
      if (user != '' && user != "undefined") {
                function createIframe(url, id) {
                    var i = document.createElement("iframe");
                    i.src = url;
                    i.scrolling = "auto";
                    i.frameborder = "0";
                    i.width = "100%";
                    i.height = "600px";
                    var k = document.getElementById(id);
                    if(k != null) k.appendChild(i);
                };
                createIframe('#','home');
                createIframe('#','profile');
                createIframe('#','contact');
                if (window.addEventListener)
                    window.addEventListener("load", createIframe, false);
                else if (window.attachEvent)
                    window.attachEvent("onload", createIframe);
                else window.onload = createIframe;
            }else{
                $("#myLoginBtn").click(function(e) {
                  e.preventDefault();
                  $("#userName").focus();
                });  
            }
            var x = document.getElementById("myAudio");
            var user = ""
                        if (typeof points != "undefined" && points != '') {

                if (points <= 500) {
                    var sendPoints = setInterval(function() {
                        checkSession(user);
                    }, 40000);
                } else if (points >= 500 && points <= 900) {
                    var sendPoints = setInterval(function() {
                        checkSession(user);
                    }, 40000);
                }
                var userNamesChecker = setInterval(function() {
                    var usersName = ['akshay', 'sdsdsds', 'dsdsdad', 'asdasd'];
                    var usersInfo = usersName[Math.floor(Math.random() * usersName.length)];
                    showOtherUsersPoints(usersInfo);
                }, 30000);
            }
            if (user == '') {
                clearInterval(sendPoints);
            }
            function checkSession(user) {
                if (user != "" && typeof user != "undefined") {
                    $.ajax({
                        url: "global-functions.php",
                        type: "POST",
                        data: {
                            user: user
                        },
                        async: false,
                        success: function(data) {
                            if (data.success == true) {
                                playAudio();
                                $(".showpoints").html(data.points);
                                alertify.success('<span class = "text-white"> 1 Point Added in the account</span>');                                
                                $(".fa-concierge-bell").effect("bounce", "slow");
                            }
                        }
                    });
                }
            }
            function playAudio() {
                x.play();
            }
            function showOtherUsersPoints(usersInfo = '') {
                alertify.warning('<center><img src="img/user.png" style ="width:30px; height:30px;"  alt="User">&nbsp;&nbsp;<strong>' + usersInfo + "***" + '</strong><br>Redeemed $10 gift card.</center>');
            }
            $(".scrollToEarn").click(function(e) {
                e.preventDefault();
                $('html, body').animate({
                    scrollTop: $("#earn-point").offset().top
                }, 2000);
            });
  </script>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...