I have small project in which i have different news.I have to include this news_all.php file in table data in the dashboard.php file. I have predefined root structure in which i cannot use include('news.php) and i dont want to use it. So in this case how i can be able to call news.php file in this table data in dashboard.php file.I have used Ajax method.I am almost done but having small mistake in my code.Any help.Thanks. Here is my code:
dashboard.php
<?php
// -- REGISTER ERSTELLEN -------------------------------------------------------
$page['register-news'] = array(
1 => array( 'News','aktiv',$page['script'],'',''),
);
$page['edit-register-news'] = array(
1 => array( 'Edit-News','aktiv',$page['script'],'',''),
);
$page['content'] .= '
<table width="538" cellspacing="0" cellpadding="0" border="0" >
<tr>
<td id="News">
<div>'.CreateRegister($page['register-news']).'</div>
'.CreateMessage().'
<div class="cont-liste-verlauf register">
</div>
</td>
</tr>
</table>';
?>
news_all.php
<?php
include 'constant/const_system.inc.php';
include 'functions/ad_json.inc';
include 'functions/ad_formulare.inc';
$html =
'<table width="538" cellpadding="0" cellspacing="0" border="0">
<tr>
<td>
<a href="news.php?id=" class="TrackNews" id="01">
<div class="welcome-rahmen lng toggleNews" id="news_269_kurz">
<p class="welcome-breadcrump">Montag, 19.05.2014</p>
<p class="welcome-subheadline">Teilnahme von MAN Top Used an der Samoter 2014</p>
<div class="newsText">
<p class="welcome-text"><img src="http://intern.autodo.de/admin/news/man-it.jpg" width="165" class="text_fixed" border="0"></p>
<p class="welcome-text">Die 29. Internationale Erd- und Bautechnik-Ausstellung Samoter fand zwischen dem 8. und 11. Mai in Verona statt und zog rund 100.000 Besucher an. Samoter ist die wichtigste italienische Messe ihrer Art, die den Themen Erdbewegung, Hochbau und Baumaschinen gewidmet ist. Zugleich ist diese Veranstaltung damit auch f? europ?chen Markt bedeutsam.</p>
</div>
</div>
</a>
<a href="news.php?id=" class="TrackNews" id="02">
<div class="welcome-rahmen lng toggleNews" id="news_264_kurz">
<p class="welcome-breadcrump">Freitag, 24.01.2014</p>
<p class="welcome-subheadline">Kaufvertrag: neue Porsche-Vorlage zum Drucken!</p>
<div class="newsText">
<img src="http://intern.autodo.de/admin/news/porsche-kaufvertrag.jpg" border="0" align="right" class="img_fixed" width=60><p class="welcome-text">Ihr AMO Druckcenter bietet Ihnen ab sofort die M?chkeit, Kaufvertr? im Porsche-Design zu nutzen.</p>
<p class="page-breadcrump">AutoDo!-Team</p>
</div>
</div>
</a>
</td>
</tr>
</table>';
$return = array(
'status' => 1,
'html' => $html
);
echo(json_encode($return)) ;
?>
ajax.js
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script>
$.ajax({
type: "POST",
url: "news_all.php",
dataType : 'json',
cache: false,
data: {},
success: function(data){
$('#news').html(data.html);
}
});
</script>