|
以下是我的 jquery 程序:
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
<title>Page Title</title>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<link rel='stylesheet' type='text/css' media='screen' href='main.css'>
<link rel="stylesheet" href="jquery.jsonview.css" />
<script src='main.js'></script>
<script src='jquery-3.6.1.min.js'></script>
<script src="jquery.jsonview.min.js"></script>
<script>
$(document).ready(function(){
var myToken =null;
var personJson = null;
$(".p0").click(function(){
var data = {
"credential" : "于小鲲",
"password" : "865851"
}
$.ajax({
type : 'POST',
dataType : 'json',
url : 'http://192.168.200.99/x_organization_assemble_authentication/jaxrs/authentication',
headers : {'x-debugger' : true},
contentType : 'application/json',
xhrFields : {'withCredentials' : true},
crossDomain : true,
data : JSON.stringify(data)
}).always(function(resultJson) {
var myJson = JSON.stringify(resultJson, null, 4);
myToken = resultJson.data.token;
alert("登录成功 !!!");
//alert(resultJson.data.token);
});
});
$(".p1").click(function(){
$.ajax({
type : 'GET',
dataType : 'json',
url : 'http://192.168.200.99/x_organization_assemble_control/jaxrs/person/list/(0)/next/999',
headers : {'x-debugger' : true, 'x-token':""+myToken},
contentType : 'application/json',
xhrFields : {'withCredentials' : true},
crossDomain : true,
}).always(function(resultJson) {
personJson = resultJson;
alert("数据后取成功 !!!");
$("#json").JSONView(personJson);
alert(personJson.data.length);
//alert(JSON.stringify(resultJson, null, 4))
});
});
$(".p2").click(function(){
var data = {
"value" : "参数"
}
$.ajax({
type : 'PUT',
dataType : 'json',
url : 'http://192.168.200.99/x_organization_assemble_control/jaxrs/person/替换参数0/set/password',
headers : {'x-debugger' : true},
contentType : 'application/json',
xhrFields : {'withCredentials' : true},
crossDomain : true,
data : JSON.stringify(data)
}).always(function(resultJson) {
alert(JSON.stringify(resultJson, null, 4))
});
});
});
</script>
</head>
<body>
<button class="p0">登录</button>
<button class="p1">执行</button>
<button class="p1">替换</button>
<div id="json"></div>
</body>
</html>
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?立即注册
x
|