计算器异步刷新问题已解决

master
istars 7 years ago
parent 1e05244780
commit d15625f2f1

@ -79,7 +79,7 @@ public class SumCirController {
String json = JSONObject.toJSONString(map); String json = JSONObject.toJSONString(map);
//System.out.println(json); //System.out.println(json);
response.getWriter().print(json); response.getWriter().print(json);
return; //return json;
}finally { }finally {
} }
@ -89,7 +89,7 @@ public class SumCirController {
String json = JSONObject.toJSONString(map); String json = JSONObject.toJSONString(map);
//System.out.println(json); //System.out.println(json);
response.getWriter().print(json); response.getWriter().print(json);
return; //return json;
} }
double sum_principal_and_intrate = 0; double sum_principal_and_intrate = 0;
@ -114,14 +114,15 @@ public class SumCirController {
String json = JSONObject.toJSONString(map); String json = JSONObject.toJSONString(map);
//System.out.println(json); //System.out.println(json);
response.getWriter().print(json); response.getWriter().print(json);
return; //return json;
} }
//System.out.println(sum_principal_and_intrate); //System.out.println(sum_principal_and_intrate);
map.put("value",sum_principal_and_intrate); map.put("value",sum_principal_and_intrate);
String json = JSONObject.toJSONString(map); String json = JSONObject.toJSONString(map);
//System.out.println(json); System.out.println(json);
response.getWriter().print(sum_principal_and_intrate); response.getWriter().print(json);
return;
} }
} }

@ -19,6 +19,8 @@
// var equ = decument.getElementsByName("equation"); // var equ = decument.getElementsByName("equation");
// var equation = equ.value(); // var equation = equ.value();
// if(amount=""){ // if(amount=""){
// alert("金额不能为空"); // alert("金额不能为空");
// return; // return;
@ -40,8 +42,10 @@
data:$("#form2").serialize(), data:$("#form2").serialize(),
async: false, async: false,
success: function (data) { success: function (data) {
var str = "<span class=\"aui-center-title\">计算应还款总金额为:"+data+"元</span>"; var str = "<span class=\"aui-center-title\">应还款总金额为:"+data.value+"元</span>";
$("#sum").append(str); $("#sum").append(str);
//console.log(data); //console.log(data);
//alert("结果为:" + data.value); //alert("结果为:" + data.value);
}, },
@ -57,6 +61,8 @@
<section class="aui-flexView"> <section class="aui-flexView">
<header class="aui-navBar aui-navBar-fixed b-line"> <header class="aui-navBar aui-navBar-fixed b-line">
<a href="index.html" class="aui-navBar-item"> <a href="index.html" class="aui-navBar-item">
@ -123,7 +129,7 @@
</a> </a>
</div> </div>
<div class="tab-button"> <div class="tab-button">
<button onclick="btnNotForm()">开始计算</button> <button onclick="btnNotForm()" type="button">开始计算</button>
<!--<input type="button" value="开始计算" onclick="btnNotForm()">--> <!--<input type="button" value="开始计算" onclick="btnNotForm()">-->
</div> </div>
</div> </div>

Loading…
Cancel
Save