From 200ce83f5c9410ac6926584632ed117a2b7cd2de Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期五, 22 十二月 2023 16:14:49 +0800 Subject: [PATCH] 完成接口开发 --- JiangSu/index.html | 68 +++++++++++++++++++++++++++++++++ 1 files changed, 67 insertions(+), 1 deletions(-) diff --git a/JiangSu/index.html b/JiangSu/index.html index 497638a..ba890de 100644 --- a/JiangSu/index.html +++ b/JiangSu/index.html @@ -1,14 +1,80 @@ 锘�<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> + <title>姹熻嫃浜ゆ帶鏅烘収楂橀�熼」鐩�</title> + <meta http-equiv="Expires" content="0" /> + <meta http-equiv="Cache" content="no-cache" /> + <meta http-equiv="Pragma" content="no-cache" /> + <meta http-equiv="Cache-control" content="no-cache" /> + <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - <title></title> + <script src="Scripts/jquery-1.7.1.min.js"></script> + <script> + $(function () { + // + }); + + function Insert() { + var data = getModel(); + + ajax("Op/Insert", "POST", data, null, null, function (rs) { + console.log(rs); + alert(rs); + }); + } + + function UpdateById() { + var data = getModel(); + + ajax("Op/UpdateById", "POST", data, null, null, function (rs) { + console.log(rs); + alert(rs); + }); + } + + function getModel() { + var model = { + id: $("#id").val(), + name: $("#name").val(), + json: $("#json").val() + }; + + return JSON.stringify(model); + } + + function ajax(url, type, data, dataType, contentType, fn) { + $.ajax({ + url: url, + type: type, + data: data, + dataType: dataType || "json", // html銆乯son銆乯sonp銆乻cript銆乼ext + contentType: contentType || "application/json", // "application/x-www-form-urlencoded" + success: function (data) { + fn(data); + }, + error: function (e) { + console.error(e); + } + }); + } + </script> </head> <body> <a href="http://localhost/JiangSu/Values/Get">GetValues</a> <br /> + <a href="http://localhost/JiangSu/Op/SelectByPage?pageSize=10&pageIndex=1&name=">SelectByPage?pageSize=10&pageIndex=1&name=</a> <br /> + <a href="http://localhost/JiangSu/Op/SelectById?id=1">SelectById?id=1</a> <br /> <a href="http://localhost/JiangSu/Op/DeleteByIds?ids=2,3">DeleteByIds?ids=2,3</a> <br /> + + <form> + <input id="id" name="id" value="3" /> <br /> + <input id="name" name="name" value="A" /> <br /> + <input id="json" name="json" value="{}" /> <br /> + + <input type="button" value="Insert" onclick="Insert();" /> + <input type="button" value="UpdateById" onclick="UpdateById();" /><br /> + </form> </body> </html> -- Gitblit v1.9.3