json:(不要json方式就去掉contentType就行)
传值不为row方式
$.ajax({
async : true,//异步
url : `http:gnls/init/gnl`,
type : 'post',
dataType: "json",
contentType : "application/json",
data:{
"username":strName,
"mobile":mobile
},
timeout : 30000,//超时时间设定30秒
success : function(response) {
alert('已发送验证码')
}
});
传值为row方式
$.ajax({
async : true,//异步
url : `http:gnls/init/gnl`,
type : 'post',
dataType: "json",
contentType : "application/json",
data:JSON.stringify({
"username":strName,
"mobile":mobile
}),
timeout : 30000,//超时时间设定30秒
success : function(response) {
alert('已发送验证码')
}
});
get:
$.ajax({
async: false,
type: "GET",
dataType: "json",
url: "http://glls/init" ,
success: function (result) {
if (result.code!='000') {
alert(result.message);
}
},
error : function() {
alert("未知错误请联系管理员");
}
});