注:错误返回:Failed to load http://xxxxxxxxxxx: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://m.cd.com' is therefore not allowed access

  如:

$.post("http://",data,function(result){
	console.log(result);
               alert(result);
	if(result == 'true'){
		alert('预约成功');
	}else if(result == 'false'){
		alert('预约失败');
	}else{
		alert(result)
	}
},'json')

 解决方法:

  

1.如果请求的是的url是PHP的,须要PHP中文件前头加入 

echo header("Access-Control-Allow-Origin:*");

  

2.如果请求的html的,这需要加入 

<meta http-equiv="Access-Control-Allow-Origin" content="*">

 

相关文章:

  • 2022-12-23
  • 2021-12-19
  • 2021-10-24
  • 2022-12-23
  • 2021-09-12
  • 2021-07-05
  • 2021-06-27
  • 2019-07-10
猜你喜欢
  • 2021-09-12
  • 2021-11-14
  • 2021-11-14
  • 2021-05-28
  • 2021-12-15
  • 2021-09-18
相关资源
相似解决方案