代码在电脑上运行良好,邮件发送后我被重定向到确认页面,但是当我在IOS或Android设备上测试时,页面只是刷新而没有真正发生。我在这里做错了什么线索?
$(document).ready(function(){
$("#send").click(function(){
var name = $("#name").val(); // gets values from form fields
var email = $("#email").val();
if(error == false){
$("#send").attr({"disabled" : "true", "value" : "Loading..." }); // disables while sending data
$.ajax({
type: "POST",
url : "send.php",
data: "name=" + name +"&email=" + email, // post all the data to php file
success: function(data)
{
if(data)
{
$("#btnsubmit").remove();
$("#mail_success").fadeIn(500);
$("#send").attr({"disabled" : "true", "value" : "Your mail is sent" });
window.location.href = 'confirm.html';
}else{
$("#mail_failed").html(data).fadeIn(500);
$("#send").removeAttr("disabled").attr("value", "send");
}
}
});
}
return false;
});