i want to replace result from readmore.php into <div id='box'>
base on id_pages at index.php after click <a class=readmore> Read More </a>
.
i tired to try how to get value from readmore.php using ajax.
this's my code
index.php
<html>
<head>
<link rel='stylesheet' type='text/css' href='style.css'>
<title> Home Page </title>
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script>
$('.readmore').click(function(){
$.ajax({
type: "POST",
url: "readmore.php",
data: dataString,
success: function(returnedData) {
$( '#daleman' ).html(returnedData);
}
});
})
</script>
</head>
<body>
<?php
error_reporting(E_ERROR | E_PARSE);
include "koneks.php";
$db = new database;
$db->connectMYSQL();
//* Memulai Tampilan Menu
echo"
<div id='menu'>
<a href='manage.php'>Manage Blog</a>
</div>
";
//* Memulai Tampilan Page
$arraypage = $db->tampilPage();
foreach($arraypage as $data) {
echo"
<input type=hidden id=idnya name='idnya' value=".$data['id_pages'].">
<div id='boxpage'>
<div id='alasatas'>
</div>
<div id='alasjudul'>
".$data['judul']."
</div>
<div>
<div id='alasfoto'>
<img height='200px' src='pict/".$data['foto']."'>
</div>
<div id='alasisi'>
<div id='daleman'>
<br>
".$data['deskripsi']."
</div>
</div>
</div>
<div id='alasketerangan'>
<center>Tanggal dibuat : ".$data['tgl_dibuat']." Label : ".$data['label']." <a class='readmore' >Read More</a> </center>
</div>
</div>
</body>
</html>
";
}
?>
this my readmore.php
<?php
include "koneks.php";
$dbi = new database;
$dbi->connectMYSQL();
echo"
$_POST[idnya]
";
?>
i need help meybe to fix my code, my thanks