如何将ajax查出的list在jsp的div中浏览
需求是输入网址,一打开网页右下角弹出弹窗,弹窗中的数据从数据库获取,我用的ajax去查,现在在action中已查出结果list,但是如何返回jsp中,并在div弹窗中迭代出来浏览,没写过这个,现在写到一半,不知道怎么写了,可能还有的写的不对,小弟愿闻其详
以下是ajax和弹窗代码
<script type="text/javascript"> $(function(){ $.ajax({ url:'AnnouncementNewOutJsp.action', async:false, data:{}, success:function(result){ } }); }); </script> <div id="msg_win" style="display: block; top: 2000px; width: 300px; visibility: visible; opacity: 1;"> <div class="icos"> <a id="msg_min" title="最小化" href="javascript:void 0">_</a><a id="msg_close" title="关闭" href="javascript:void 0">×</a> </div> <div id="msg_title"> 重要提示:培训系统要写好 </div> <div id="msg_content" style="width: 300px;"> 1、要好好写培训系统: <a href="www.baidu.com" target="_blank">www.baidu.com</a> <br> 2、要写好培训系统: <a href="www.baidu.com" target="_blank">www.baidu.com</a> <br> <span style="color: blue">3、完成任务</span> <br> </div> </div>
/** * 找出最新的size条公告 */ public String findNew() { try { list = announcementService.selectNewAnnouncement(SIZE); if (list != null) { result = true; }else{ result = false; } return "success"; } catch (Exception e) { e.printStackTrace(); return "error"; } }