Merge branch 'develop' of http://g.28ms.com:8000/yangjianbin/page into develop
Showing
3 changed files
with
51 additions
and
2 deletions
| ... | @@ -11,3 +11,24 @@ | ... | @@ -11,3 +11,24 @@ |
| 11 | <script type="text/javascript" src="/resource/datatable.js"></script> | 11 | <script type="text/javascript" src="/resource/datatable.js"></script> |
| 12 | <script src="https://cdn.bootcss.com/holder/2.9.4/holder.min.js"></script> | 12 | <script src="https://cdn.bootcss.com/holder/2.9.4/holder.min.js"></script> |
| 13 | <script type="text/javascript" src="/resource/upload.js"></script> | 13 | <script type="text/javascript" src="/resource/upload.js"></script> |
| 14 | <script> | ||
| 15 | (function($){ | ||
| 16 | $.fn.serializeJson=function(){ | ||
| 17 | var serializeObj={}; | ||
| 18 | var array=this.serializeArray(); | ||
| 19 | var str=this.serialize(); | ||
| 20 | $(array).each(function(){ | ||
| 21 | if(serializeObj[this.name]){ | ||
| 22 | if($.isArray(serializeObj[this.name])){ | ||
| 23 | serializeObj[this.name].push(this.value); | ||
| 24 | }else{ | ||
| 25 | serializeObj[this.name]=[serializeObj[this.name],this.value]; | ||
| 26 | } | ||
| 27 | }else{ | ||
| 28 | serializeObj[this.name]=this.value; | ||
| 29 | } | ||
| 30 | }); | ||
| 31 | return serializeObj; | ||
| 32 | }; | ||
| 33 | })(jQuery); | ||
| 34 | </script> | ... | ... |
| ... | @@ -23,4 +23,7 @@ | ... | @@ -23,4 +23,7 @@ |
| 23 | <meta name="keywords" content=""> | 23 | <meta name="keywords" content=""> |
| 24 | <meta name="description" content=""> | 24 | <meta name="description" content=""> |
| 25 | <title>标题</title> | 25 | <title>标题</title> |
| 26 | <script> | ||
| 27 | var apiBaseUrl = "http://151.28ms.com:8088/"; | ||
| 28 | </script> | ||
| 26 | </head> | 29 | </head> | ... | ... |
| ... | @@ -8,7 +8,7 @@ | ... | @@ -8,7 +8,7 @@ |
| 8 | <div class="panel panel-default"> | 8 | <div class="panel panel-default"> |
| 9 | <div class="panel-header">填写借款人信息</div> | 9 | <div class="panel-header">填写借款人信息</div> |
| 10 | <div class="panel-body"> | 10 | <div class="panel-body"> |
| 11 | <form action="<?=site_url('work/added')?>" method="post" class="form form-horizontal" id="work_add"> | 11 | <form action='order/into/applyOrder' method="post" class="form form-horizontal" id="work_add"> |
| 12 | <div class="row cl"> | 12 | <div class="row cl"> |
| 13 | <label class="form-label col-xs-4 col-sm-3">姓名</label> | 13 | <label class="form-label col-xs-4 col-sm-3">姓名</label> |
| 14 | <div class="formControls col-xs-3 col-sm-3"> | 14 | <div class="formControls col-xs-3 col-sm-3"> |
| ... | @@ -29,7 +29,7 @@ | ... | @@ -29,7 +29,7 @@ |
| 29 | </div> | 29 | </div> |
| 30 | <div class="row cl"> | 30 | <div class="row cl"> |
| 31 | <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3"> | 31 | <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3"> |
| 32 | <input class="btn btn-primary radius" type="submit" value="提交"> | 32 | <input id="work_add_btn" class="btn btn-primary radius" type="button" value="提交"> |
| 33 | </div> | 33 | </div> |
| 34 | </div> | 34 | </div> |
| 35 | </form> | 35 | </form> |
| ... | @@ -57,6 +57,31 @@ | ... | @@ -57,6 +57,31 @@ |
| 57 | } | 57 | } |
| 58 | } | 58 | } |
| 59 | }); | 59 | }); |
| 60 | $("#work_add_btn").click(function(){ | ||
| 61 | var targetUrl = $("#work_add").attr("action"); | ||
| 62 | var data = $("#work_add").serializeJson(); | ||
| 63 | $.ajax({ | ||
| 64 | type:'post', | ||
| 65 | url:apiBaseUrl + targetUrl, | ||
| 66 | cache: false, | ||
| 67 | data:JSON.stringify(data), | ||
| 68 | dataType:'json', | ||
| 69 | contentType: "application/json; charset=UTF-8", | ||
| 70 | success:function(data){ | ||
| 71 | if(data.msg){ | ||
| 72 | alert(data.msg); | ||
| 73 | } else if(data.code != 0){ | ||
| 74 | alert('请求失败'); | ||
| 75 | } else { | ||
| 76 | alert('请求成功'); | ||
| 77 | } | ||
| 78 | }, | ||
| 79 | error:function(){ | ||
| 80 | alert("请求失败") | ||
| 81 | } | ||
| 82 | }) | ||
| 83 | |||
| 84 | }) | ||
| 60 | }); | 85 | }); |
| 61 | </script> | 86 | </script> |
| 62 | </body> | 87 | </body> | ... | ... |
-
Please register or sign in to post a comment