Home > OS >  Stuck in login page spinning when submitting logging request?
Stuck in login page spinning when submitting logging request?

Time:08-15

I have a website, with some pages like any other website. It works perfectly on my computer(localhost).

But when I uploaded it to a real server, some problems appeared in login pages..

The problem's after I insert my login information and click submit IT DOESN'T redirect me to main page.. It keeps spinning!

$(document).ready(function() {
  end_loader();

  $('#ulogin-form').submit(function(e) {
    e.preventDefault()
    var _this = $(this)
    var el = $('<div>')
    el.addClass('alert alert-danger err_msg')
    el.hide()
    $('.err_msg').remove()
    if ($('#password').val() != $('#cpassword').val()) {
      el.text('Password does not match')
      _this.prepend(el)
      el.show('slow')
      $('html, body').scrollTop(0)
      return false;
    }
    if (_this[0].checkValidity() == false) {
      _this[0].reportValidity();
      return false;
    }
    start_loader()
    $.ajax({
      url: _base_url_   "classes/Login.php?f=login_user",
      method: 'POST',
      type: 'POST',
      data: new FormData($(this)[0]),
      dataType: 'json',
      cache: false,
      processData: false,
      contentType: false,
      error: err => {
        console.log(err)
        alert('An error occurred')
        end_loader()
      },
      success: function(resp) {
        if (resp.status == 'success') {
          location.href = ('./')
        } else if (!!resp.msg) {
          el.html(resp.msg)
          el.show('slow')
          _this.prepend(el)
          $('html, body').scrollTop(0)
        } else {
          alert('An error occurred')
          console.log(resp)
        }
        end_loader()
      }
    })
  })
})

CodePudding user response:

As you have stated that the code and everything else works offline and the responses made by the other programmers, I will continue on that for now by asuming it works offline as you have said.

It might be the case that your local enviroment is more up to date then your online server enviroment. As local you could have PHP 8 but online run 7.0

Example: PHP 7.2 added 'PASSWORD_ARGON2ID' and if you have used that then online enviroment PHP 7.1 will never work since it doesn't know what to do.

Please confirm by: Create a file that contains the following code:

<?php
 phpinfo();
?>

and confirm that your online server is atleast equal to your offline version. Further versions might rollback certain functions so try to have the exact same PHP and ?Linux or Apache? version as offline.

After you confirm that the offline and online versions are the same, let's then try the other issue such as "undefined mysqli_stmt::$get->result in class/login.php line50", it would help if you would provide code.

Also, if you upload your work (code) directly to git->to online server, make sure your .gitignore doesn't ignore the files that you need.

Let's hope this helps.

  • Related