ajax请求后端数据
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script type="text/javascript">
function sendajaxpost(){
let json = {
username: "lindont",
password: "123456"
}
$.ajax({
type: "post",
url: "https://localhost:8787/test/params",
contenttype: "application/json; charset=utf-8",
data: json.stringify(json), /*传给后端的数据格式json*/
datatype: "json", /*后端返回的数据格式json*/
success: function(data){
console.log(data);
},
error: function (message) {
}
});
}
function sendajaxget() {
$.ajax({
type: "get",
url: "https://localhost:8787/test",
success: function(data){
console.log(data);
},
error: function (message) {
}
});
}
</script>
如对本文有疑问,
点击进行留言回复!!
相关文章:
-
-
-
-
-
-
-
-
-
-
-
CSS中的四种定位区别详解
我们都知道,前端开发里面的css中常用的定位方式有普通定位,相对定位,绝对定位、固定定位定位这四种。但是很多零基础的前端小白都不知道这4种定位方式都有什么作用和...
[阅读全文]
网友评论