| | |
| | | <!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、json、jsonp、script、text |
| | | 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> |