ajax调用tag单独提出为一个函数

This commit is contained in:
wangxin
2018-07-09 18:08:54 +08:00
parent 3b60b81c72
commit 5c828fee58

View File

@@ -18,19 +18,9 @@
$("#searchForm")[0].reset(); $("#searchForm")[0].reset();
}); });
if(!"${bean.reportBusinessType}"){ if(!"${bean.reportBusinessType}"){
$.ajax({ ajaxGetLabelReport();
type:'post', }else if("${bean.reportBusinessType}"=="label_report"){
async:false, ajaxGetLabelReport();
url:'${ctx}/report/ajaxNtcTagReport',
data:{
"action":$('select[name="action"]').val(),
"reportType":$('input[name="reportType"]:checked').val()
},
dataType:"html",
success:function(data){
$("#label").html(data);
}
});
} }
$("input[name='reportType']").each(function(){ $("input[name='reportType']").each(function(){
var type='${bean.reportType}'; var type='${bean.reportType}';
@@ -45,13 +35,19 @@
var reportBusinessType=$("#reportBusinessType").val(); var reportBusinessType=$("#reportBusinessType").val();
var reportType=$('input[name="reportType"]:checked').val(); var reportType=$('input[name="reportType"]:checked').val();
if($(this).data("bussiness")=="label_report"){ if($(this).data("bussiness")=="label_report"){
ajaxGetLabelReport();
}
}
});
});
var ajaxGetLabelReport=function(){
$.ajax({ $.ajax({
type:'post', type:'post',
async:false, async:false,
url:'${ctx}/report/ajaxNtcTagReport', url:'${ctx}/report/ajaxNtcTagReport',
data:{ data:{
"action":action, "action":$('select[name="action"]').val(),
"reportType":reportType "reportType":$('input[name="reportType"]:checked').val()
}, },
dataType:"html", dataType:"html",
success:function(data){ success:function(data){
@@ -59,10 +55,6 @@
} }
}); });
} }
}
});
});
</script> </script>
</head> </head>
<body> <body>