我前端使用ajax进行异步跨域请求的,控制台报错但仍然有值返回
我应该怎样设置才能做到不允许跨域且没有值返回
前端代码`
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(function(){
$('input').click(function(){
$.ajax({
url:'https://stzy.site/a.php',
type:'get',
success:function(e){
console.log(e)
}
})
})
})
</script>
</head>
<body>
<input type="button" value="按钮">
</body>
</html>`
php代码`
<?php
echo 1;
?>`
我也遇到这个问题了,有人知道吗?