jQuery-Ajax请求-post方法

钱华晖
2023-12-01
<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <div id="box"></div>
    <script src="./jquery.js"></script>
    <script>


    // 使用 post() 方法向服务器发送 post 类型的请求
    $.post('http://192.168.1.35:8080/api/save_student', {
        name: '刘旭凯',
        age: 20,
        gender: '男',
        clazz: '火花18',
        remark: '戴眼镜',
        tel: '119',
        address: '郑州'
    }, 
    function(data, textStatus, xhr) {
        console.log(data)
    },
    'json')


    </script>
</body>

</html>
 类似资料: