douchuang1861 2019-08-18 18:35
浏览 63
已采纳

js代码不适用于Web托管,但它适用于localhost

I'm trying to run some AJAX code on my web hosting. The problem is that it works on my localhost but it doesn't work on my web hosting. Do anybody know how to solve this problem?

This is the code:

function validarCorreo(mail){
  var bool = false;
  var mail = {"mail" : mail};
  $.ajax({
    data: mail,
    url: '/carepets/validaciones/validarCorreo.php',
     type: 'post',
    async: false,
     success: function(response){
       if(response == true){
        $("#autenticacionCorreo").html("El correo esta      disponible.").css("color","green");
        bool = true;
      }else{
        $("#autenticacionCorreo").html("El correo esta ya registrado o es incorrecto.").css("color","red");
      }
    }
  });
  return bool;
}
  • 写回答

1条回答 默认 最新

  • duanmeng3476 2019-08-19 01:28
    关注

    Two things you should check: Check if you properly included jQuery in your project. Also check if relative path of validarCorreo.php file is correct on your server and if it is ok then check if there are no errors in that file. It would be good if you could check your Network Activity tab to see and share with us what happens when you invoke validarCorreo function.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?