龙空技术网

4种Jquery常见请求,Get、Post、Put、Delete

tinygo 158

前言:

眼前我们对“jqueryqtip持续时间”都比较注重,看官们都想要了解一些“jqueryqtip持续时间”的相关内容。那么小编同时在网上网罗了一些关于“jqueryqtip持续时间””的相关知识,希望我们能喜欢,看官们快快来学习一下吧!

GET的2种方法

设置2个按钮

POST的2种方法POST的方法DELETE的方法

文件源码

<!DOCTYPE html><html lang="en"><head>    <meta charset="UTF-8">    <title>Title</title>    <link rel="stylesheet" href="static/css/bootstrap.css"></head><body class="container"><div id="app">    <h1>Get请求</h1>    <button class="btn btn-block btn-primary" @click="GetAjax()">Get请求(ajax方法)</button>    <button class="btn btn-block btn-primary" @click="GetGet()">Get请求(Get方法)</button>    <h1>Post请求</h1>    <button class="btn btn-block btn-primary" @click="PostAjax()">Post请求(ajax方法)</button>    <button class="btn btn-block btn-primary" @click="PostPost()">Post请求(Post方法)</button>    <h1>Put请求</h1>    <button class="btn btn-block btn-primary" @click="PutAjax()">Put请求(ajax方法)</button>    <h1>Delete请求</h1>    <button class="btn btn-block btn-primary" @click="DeleteAjax()">Delete请求(ajax方法)</button>    <pre v-html="resp1"></pre>    <pre v-html="resp1.user"></pre></div><script src="static/js/vue.js"></script><script src="static/js/jquery-3.6.0.js"></script><script>    Vue.config.productionTip = false    var vm = new Vue({        el: "#app",        data: {            resp: [                {                    "id": 0,                    "name": "",                    "age": "0",                    "address": "",                    "color": ["",]                },            ],            resp1: {                "id": 0,                "name": "",                "age": "0",                "address": "",                "color": ["",]            }        },        methods: {            //Get请求(ajax方法)            GetAjax: function () {                $.ajax({                    type: 'GET',                    url: ";,                    data: {                        "id": 10,                        "name": "张三",                        "age": 18,                        "address": "南京",                        "color": ["红色", "白色"]                    },                    success: function (data, status) {                        console.log(data);                        console.log(status);                        vm.resp1 = data                    },                });            },            //Get请求(Get方法)            GetGet: function () {                $.get(                    ";,                    {                        "id": 10,                        "name": "张三",                        "age": 18,                        "address": "南京",                        "color": ["红色", "白色"]                    },                    function (data, status) {                        console.log(data);                        console.log(status);                        vm.resp1 = data                    });            },            // Post请求(ajax方法)            PostAjax: function () {                $.ajax({                    type: 'POST',                    url: ";,                    data: {                        "id": 10,                        "name": "张三",                        "age": 18,                        "address": "南京",                        "color": ["红色", "白色"]                    },                    success: function (data, status) {                        console.log(data);                        console.log(status);                        vm.resp1 = data                    },                });            },            //Post请求(Post方法)            PostPost: function () {                $.post(                    ";,                    {                        "id": 10,                        "name": "张三",                        "age": 18,                        "address": "南京",                        "color": ["红色", "白色"]                    },                    function (data, status) {                        console.log(data);                        console.log(status);                        vm.resp1 = data                    });            },            // Put请求(ajax方法)            PutAjax: function () {                $.ajax({                    type: 'PUT',                    url: ";,                    data: {                        "id": 10,                        "name": "张三",                        "age": 18,                        "address": "南京",                        "color": ["红色", "白色"]                    },                    success: function (data, status) {                        console.log(data);                        console.log(status);                        vm.resp1 = data                    },                });            },            //Delete请求(ajax方法)            DeleteAjax: function () {                $.ajax({                    type: 'DELETE',                    url: ";,                    data: {                        "id": 10,                        "name": "张三",                        "age": 18,                        "address": "南京",                        "color": ["红色", "白色"]                    },                    success: function (data, status) {                        console.log(data);                        console.log(status);                        vm.resp1 = data                    },                });            }        }    })</script></body></html>

标签: #jqueryqtip持续时间