Commit afa01da3 authored by yangyuxin's avatar yangyuxin

测试页面按钮分装方法

parent 565ea216
......@@ -69,18 +69,61 @@
<script>
var url = "http://localhost:7070"
$(function(){
$("#delcareBtn").click(function(){
//按期申报
var btnObj1 = $("#delcareBtn");
declareFun(btnObj1, "declare");
//更正申报
var btnObj2 = $("#amendBtn");
declareFun(btnObj2, "amend");
//逾期申报
var btnObj3 = $("#overdueBtn");
declareFun(btnObj3, "overdue");
//清册注销
var btnObj4 = $("#cancellationBtn");
declareFun(btnObj4, "cancellation");
// $("#delcareBtn").click(function(){
// $.ajax({
// type: "GET",
// url: url+"/online_report/declare",
// dataType: "json", // 请求方式为jsonp
// data: {
// djxh: $("#form_djxh").val()
// },
// success: function (data) { //客户端jquery预先定义好的callback函数,成功获取跨域服务器上的json数据后,会动态执行这个callback函数
// if (data.success) {
// localStorage.setItem("djxh",$("#form_djxh").val());
// window.location.href = "/jsp/declare/index.html";
// }
// },
// error: function(xhr){
// //jsonp 方式此方法不被触发
// console.log("=======error======================",xhr)
// }
// })
// });
//四个按钮请求的公共方法
function declareFun (btnObj, param) {
btnObj.click(function(){
$.ajax({
type: "GET",
url: url+"/online_report/declare",
url: url+"/online_report/" + param,
dataType: "json", // 请求方式为jsonp
data: {
djxh: $("#form_djxh").val()
},
success: function (data) { //客户端jquery预先定义好的callback函数,成功获取跨域服务器上的json数据后,会动态执行这个callback函数
if (data.success) {
localStorage.setItem("djxh",$("#form_djxh").val());
if (data.success) {
if (param == "declare") {
window.location.href = "/jsp/declare/index.html";
}else if (param == "amend") {
}else if (param == "overdue") {
}else if (param == "cancellation") {
}
}
},
error: function(xhr){
......@@ -88,7 +131,8 @@
console.log("=======error======================",xhr)
}
})
})
});
}
})
</script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment