我的目标是显示身份验证是成功还是失败。
<script>
function getCallbackUrl() {
return 'https://' + window.location.href.split('callback=')[1];
}
$("#submit").click(function(){
var username = $("input[name=username]").val();
var password = $("input[name=password]").val();
// console.log(username + password);
$.ajax({
url: getCallbackUrl(),
headers: {"Content-type":"application/json"},
data: '{ "value": { "username": "'+ username + '", "password": "' + password + '", "name": "test2", } }',
// data: '{ "value": { "name": "test", } }',
type: 'POST',
success: function(r) {
console.log(r);
},
error: function(r) {
console.error(r);
}
});
$("input").prop('disabled', true);
});
我该怎么做?