Ajax+jquery在首页显示新闻遇到加载问题??
我在首页用ajax显示前五条新闻:这是我在:
<script type="text/javascript">
function showinfo(){
var pdata =document.getElementById("newInfo").innerHTML;
$.ajax({
type:"POST",
url:"${ctx}/message/message!showinfo.action",
data:pdata,
success:function (data){
document.getElementById("newInfo").innerHTML=data;
},
error:function (data){
alert("没有访问的信息!");
}
});
}
</script>
在index.jsp中:我显示消息的那个小块:<td height="174">
<div id="newInfo">
<table border="0" height="112" align="center" cellpadding="0" cellspacing="0" bgcolor="#666666" id="listTable">
<tr>
<td width="254" height="18" bgcolor="#FFFFFF" class="STYLE18">NEWS</td>
<td width="89" height="18" bgcolor="#FFFFFF">
<div align="right"><a href="news-center.html">
<img src="images/more.jpg" width="46" height="15" border="0"/></a>
</div>
</td>
</tr>
<s:iterator value="page.result">
<tr>
<td height="18" bgcolor="#FFFFFF"><p align="left" class="STYLE33">
<a href="news2009-11-06.html" class="STYLE24 STYLE32" style=" text-decoration:none">${title}</a></p>
</td>
<td bgcolor="#FFFFFF"><span class="STYLE20">
<span class="STYLE23"> ${createDate}</span></span>
</td>
</tr>
</s:iterator>
</table></div>
然后在消息Action中:
@Results( { @Result(name = "reload", location = "message!list.action", type = "redirect") })
public class MessageAction extends ActionSupport {
// 分页显示消息
public String list() throws Exception {
page = messageManager.pager(page);
catalogs = messageManager.getCatalogTypeAll();
return "list";
}
public String showinfo() throws Exception {
page = messageManager.pager(page);
catalogs = messageManager.getCatalogTypeAll();
return "reload";
}
但是以上做的达不到效果,在index.jsp中没有显示新闻,我该怎么改这一块,达到效果啊??希望各位帮我了谢谢,我现在很急,对ajax不是很熟,非常感谢!!!!