为什么会出现此错误?
跨源请求仅支持以下协议方案:http,数据,chrome,chrome扩展名,https。
<body>
<form method="POST" id="myform">
<input type="text" name="name"> <br>
<input type="text" name="email"> <br>
<input type="submit" name="submit" value="Click">
</form>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('form').submit(function(e){
e.preventDefault();
var data = $('#myform').serialize();
console.log(data);
$.ajax({
type: 'POST',
url: 'valid.php',
data: data,
dataType: 'json',
success: function(d){
console.log(d);
}
});
});
});
</script>
</body>