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.

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

报告相同问题?

悬赏问题

  • ¥15 winform的chart曲线生成时有凸起
  • ¥15 msix packaging tool打包问题
  • ¥15 finalshell节点的搭建代码和那个端口代码教程
  • ¥15 用hfss做微带贴片阵列天线的时候分析设置有问题
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 海浪数据 南海地区海况数据,波浪数据
  • ¥20 软件测试决策法疑问求解答