[英]js code doesn't work on web hosting but it works on localhost
I'm trying to run some AJAX code on my web hosting.我正在尝试在我的虚拟主机上运行一些 AJAX 代码。 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;
}
Two things you should check: Check if you properly included jQuery in your project.你应该检查两件事: 检查你是否在你的项目中正确地包含了 jQuery。 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.
还要检查您的服务器上的 validarCorreo.php 文件的相对路径是否正确,如果没问题,则检查该文件中是否没有错误。 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.
如果您可以检查您的网络活动选项卡以查看并与我们分享调用 validarCorreo 函数时发生的情况,那就太好了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.