0
我试图执行一些计算使用下面的代码中显示的网址,每次运行错误代码alert():functiom被调用。 PLs帮助为什么ajax请求失败?
$("#button").click(function(){
$("#form1").validationEngine();
if($('div input[type=text]').val() != "") {
var textfield2=document.getElementById("textfield2").value;
var textarea=document.getElementById("textarea").value;
var dataS=$("#form1").serialize();
$.ajax({
type: "POST",
url: "http://some_site/ppp.php",
data:dataS,
crossDomain: true,
success: function(){
$("#result").empty().html("<h2>Your request has been received </h2>");
},
error: function(){
alert(dataS);
}
});
}
return false;
});
是您在发出请求的页面所在的域上发出请求的网址? –
我的猜测是失败,因为它是一个跨域请求,跨域服务器没有实现CORS。 –
@JohnBoker我不这么认为,请参阅'crossDomain:true'? –