$(function(){ newsContent(); getNewsPreNext( ); }); function newsContent( ){ var queryObj = { id : param_newsId }; $.ajax({ type: "POST", url: ROOT_PATH+"/news/getNews/"+param_newsId, success: function( data ){ $("#title").html( data.title ); $("#contentInfo").html( data.content ); var str = ""; if( data.issuedtime!=null ){ str = new Date(data.issuedtime).dateFormat("Y年m月d H:s"); if( data.sourcestitle != null ){ str += ''+data.sourcestitle+''; } } $( "#issuedTimeDiv" ).html( str ); },error : function (XMLHttpRequest, textStatus, errorThrown) { //alert( textStatus ); //alert( "系统错误" ); } }); } function getNewsPreNext( ){ var queryObj = { id : param_newsId }; $.ajax({ type: "POST", url: ROOT_PATH+"/news/getNewsPreNext/"+param_newsId, success: function( data ){ //console.log( data ); var preNews = data.preNews; var nextNews = data.nextNews; if( preNews != null && preNews.id != null ){ var preStr = ""; preStr = '上一篇:'+preNews.title+''; $("#preDiv").html( preStr ); } if( nextNews != null && nextNews.id != null ){ var str = ""; str = '下一篇:'+nextNews.title+''; $("#newDiv").html( str ); } },error : function (XMLHttpRequest, textStatus, errorThrown) { //alert( textStatus ); //alert( "系统错误" ); } }); }