ajax的坑

$('#mkcode').on('click',function(){
$.ajax({
type : 'POST',
url : '__URL__/mkcode',
data : {},
dataType: 'json',          //~~这里是dataTye 写成datatye 或没写json会接受不到json过来的数据
success : function(data){
console.log(data);
if (data.errno){
alert(data.errdesc);
} else {
$('#authorize').val(data.code);
}
},error : function(){
alert('网络错误');
}
});
});
原文地址:https://www.cnblogs.com/pansidong/p/9609340.html