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)); } }); });
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!
2016-11-14 在c#中使用servicestackredis操作redis