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('网络错误');
}
});
});
posted @ 2018-09-08 15:29  盘思动  阅读(274)  评论(0编辑  收藏  举报