求助

qq_28655429 2017-05-18 07:34:12
ajax异步请求 代码:
$("#btn")
.click(
function() {
var msgNo = $('#mko').text();
var url = "../rtnmsg/rtnmsglist.action?&msgNo=" + msgNo;
$.ajax({
type : 'get',
async : true,
url : url,
cache : false,
success : function(data) {
$("#alert_box").html(data);
}
});
});

之后controller层代码:
@Controller
@RequestMapping("/rtnmsg")
public class RtnmsgController {
@Autowired
private RtnmsgService rtnmsgService;
@RequestMapping("/rtnmsglist")
public ModelAndView rtnmsglist(HttpServletRequest req,@RequestParam("msgNo") String msgNo) throws Exception {
ModelAndView mv=new ModelAndView();
User user=(User) req.getSession().getAttribute("loginUser");
String ebcid=user.getEbcId();
if (msgNo == null || "".equals(msgNo)) {
List<ReturnMsg> listrtn = rtnmsgService.findByNo(ebcid, msgNo);
mv.addObject("listrtn", listrtn);
} else {
List<ReturnMsg> listrtn = rtnmsgService.findByNo(ebcid, msgNo);
mv.addObject("listrtn", listrtn);
}

mv.setViewName("/WEB-INF/jsp/orderlist2.jsp");
return mv;
}

orderlist2.jsp的代码:
<div id="alert_box">

<c:forEach items="${listrtn}" var="listrtn">
<button id="gb" style="position:absolute; right:1px;background-color:#d1d1d1;color:red; width:15px;">X</button>
<p>回执状态:${listrtn.returnStatus }</p>
<p>回执时间:${listrtn.returnTime }</p>
<p>回执信息:${listrtn.returnInfo }</p>

</c:forEach>

</div>

<script>
var width=document.documentElement.clientWidth||document.body.clientWidth;
var height=document.documentElement.clientHeight||document.body.clientHeight;
document.getElementById("btn").addEventListener("click",alert_box);
document.getElementById("btn1").addEventListener("click",alert_box);
document.getElementById("btn2").addEventListener("click",alert_box);
document.getElementById("btn3").addEventListener("click",alert_box);
document.getElementById("gb").addEventListener("click",alert_box1);
function alert_box()
{
document.getElementById("alert_box").style="display:inline;position:absolute;left:"+Math.floor((width-200)/3)+"px;top:"+Math.floor((height-200)/3)+"px;";
}

function alert_box1()
{
document.getElementById("alert_box").style="display:none";
}

</script>

到了页面F12检查显示时会多出一个div盒子





<style>
#alert_box
{
width: 200px;
height: 200px;
background-color: red;
display: none;
border:1px;
border-color:red;
position: absolute;

}
</style>

<div id="alert_box">


<button id="gb" style="position:absolute; right:1px;background-color:#d1d1d1;color:red; width:15px;">X</button>
<p>回执状态:100</p>
<p>回执时间:20170518150905597</p>
<p>回执信息:入库成功</p>



</div>

让数据无法显示出来,怎么弄?


...全文
274 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

6,721

社区成员

发帖
与我相关
我的任务
社区描述
专题开发/技术/项目 Google技术社区
社区管理员
  • Google技术社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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