Uncaught ReferenceError: collectionByBatchId is not defined 求助

Dingpeiyuan 2015-10-29 10:59:40
小弟刚入本行,第一次发帖。相信以后还会碰到很多问题,所以分就省着点发了。
为方便好心为我解答的大大们 看 我就从工程中截取这两个相关的部分
问题就是文章标题 JS方法就在上面,不是很理解为什么会找不到,找了一个上午发现不出问题。如果是语法错误,希望大神们指正下

<%@ include file="../common/includes.jsp"%>
<%@ page language="java" contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Uncaught ReferenceError: collectionByBatchId is not defined </title>
<script type="text/javascript">
function collectionByBatchId(batchId) {
currentBatchId = batchId;
collection();
}
function collection(){
var baseUrl = "${_contextPath}/";
if(currentBatchId == ""){
return;
}
$.get(baseUrl+"views/drugSelectController/"+currentBatchId+"/collection"+"?dt="+new Date().getTime(),function(data, status){
renderMainContentBody(data);
$("#content_title").text("意见征集");
});
}
</script>
</head>
<body>
<div class="mid2 fl" >
<table class="table table-hover table-condensed table-bordered" border="1" id="tableCH">
<thead>
<tr>
<th class="th-inner" data-halign="center" data-field="operate" style="text-align:center;">操作</th>
</tr>
</thead>
<tbody>
<c:if test="${! empty results}">
<c:forEach items="${results}" var="obj" varStatus="status">
<tr style="text-align:center;">
<td style="height: 23px;width:70px;text-align:center;" data-field="status">
<c:choose>
<c:when test="${obj.selectedStatus eq 1}">
<button class="btn btn-info" type="button" onclick="drugSelect('${obj.id}')" >申报</button>
</c:when>
<c:when test="${obj.selectedStatus eq 3}">
<button class="btn btn-info" type="button" onclick="collectionByBatchId(${obj.id})" >反馈</button>
</c:when>
<c:otherwise>
<a href="#" onclick="drugSelect('${obj.id}')">查看</a>
</c:otherwise>
</c:choose>
</td>
</tr>
</c:forEach>
</c:if>
</tbody>
</table>
</div>
</body>
</html>
...全文
106 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
Go 旅城通票 2015-10-29
  • 打赏
  • 举报
回复
发最终客户端生成的html代码,发包含服务器端代码不知道你数据有什么

87,955

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧