ajax 调用

一、Post

复制代码
$("#btn30").on('click', function () {
    $.ajax({
        type: "post",
        contentType: "application/json",
        dataType: "json",
        url: "https://localhost/api/app/abc",
        data: JSON.stringify({
            "server": "ddd",
            "address": "aaa@bbb.ccc",
            "displayName": "aaa"
        }),
        success: function (result) {
            console.log(result);
            alert("SUCCESS:" + JSON.stringify(result));
        },
        error: function (msg) {
            console.log(msg);
            alert("ERROR:" + JSON.stringify(msg));
        }
    });
});
复制代码

二、Put

复制代码
$("#btn28").on('click', function () {
    $.ajax({
        type: "put",
        contentType: "application/json",
        dataType: "json",
        url: "https://localhost/api/app/ddd/e5a4e4a7-e4ea-45a0-b2ce-5eaee475736d",
        data: JSON.stringify({
            url: "https://www.baidu.com"
        }),
        success: function (result) {
            console.log(result);
            alert("SUCCESS:" + JSON.stringify(result));
        },
        error: function (msg) {
            console.log(msg);
            alert("ERROR:" + JSON.stringify(msg));
        }
    });
});
复制代码

三、Delete

复制代码
$("#btn29").on('click', function () {
    $.ajax({
        type: "delete",
        contentType: "application/json",
        dataType: "json",
        url: "https://localhost/api/app/nnn/e5a4e4a7-e4ea-45a0-b2ce-5eaee475736d",
        success: function (result) {
            console.log(result);
            alert("SUCCESS:" + JSON.stringify(result));
        },
        error: function (msg) {
            console.log(msg);
            alert("ERROR:" + JSON.stringify(msg));
        }
    });
});
复制代码

四、Get

复制代码
$("#btn24").on('click', function () {
    $.ajax({
        type: "get",
        headers: {
            "Authorization":"Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IjNCMkYxRjRFRUU4MjNDODlCMUU1N0UyNEMzRUJFNzVBRjBGMEM4MEEiLCJ4NXQiOiJPeThmVHU2Q1BJbXg1WDRrdy12bld2RHd5QW8iLCJ0eXAiOiJhdCtqd3QifQ.eyJpc3MiOiJodHRwczovL2xvY2FsaG9zdDo0NDMzOC8iLCJleHAiOjE3Mjk3MzU2NDQsImlhdCI6MTcyOTczMjA0NCwiYXVkIjoiSXNwV2ViIiwic2NvcGUiOiJJc3BXZWIiLCJqdGkiOiJkMGRhYzc2YS1jOGMxLTRhOTAtYWU3Yy1jNTMwZDFiZTAxNWMiLCJzdWIiOiIzYTE1Y2IwNy00NmNkLTEyYWEtM2Q4OC1mOGVmMDYxM2U1N2QiLCJ1bmlxdWVfbmFtZSI6ImFkbWluIiwicHJlZmVycmVkX3VzZXJuYW1lIjoiYWRtaW4iLCJnaXZlbl9uYW1lIjoiYWRtaW4iLCJyb2xlIjoiYWRtaW4iLCJlbWFpbCI6ImFkbWluQGFicC5pbyIsImVtYWlsX3ZlcmlmaWVkIjoiRmFsc2UiLCJwaG9uZV9udW1iZXJfdmVyaWZpZWQiOiJGYWxzZSIsIm9pX3Byc3QiOiJJc3BXZWJfQXBwIiwiY2xpZW50X2lkIjoiSXNwV2ViX0FwcCIsIm9pX3Rrbl9pZCI6IjNhMTVjZTNkLTNkY2MtNjQ3Yy1kYjFhLTQ1ODc2MGQwMjA0NiJ9.RrtxIQvXavfz8k9UlSrkDbbIvGztHXan6FfBkXv4efNsnJJAnf8_wwUaCbQiC6u2YNhkW2TZ-TnpYZ2V8dF2OmzKk-FsYxVPt822sXhVac4yOysUKBngRb8l1FV7ybswIEY6NjXwUt3UD2uCd0smP_AiTkWxITVg-gXnpbS_onXTrkMGJxcBoxLCKlGBX6nH7uxzClyiOZDndOotIDhwNWJTNcf_IrLu4Ey3zBHi8mACx-m_J7XgWRgjMwD24auJC3O62jNlY1ZsHLRuzxQFvj9OFaQjBqGrk-BPQCKonfrgHMBzPnWhD1yxJ1qZ154nxbxNJMK1smPb-m0iJCmc7w"
        },
        contentType: "application/json",
        url: "https://localhost:44338/api/app/mmm?DomainName=www.shhh.com&sorting=name desc",
        success: function (result) {
            console.log(result);
        },
        error: function (msg) {
            alert("ERROR" + JSON.stringify(msg));
        }
    });
});
复制代码

 

posted @   邪不压正!  阅读(16)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!
历史上的今天:
2016-11-14 在c#中使用servicestackredis操作redis
点击右上角即可分享
微信分享提示