Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(isset($_GET['show']))
- {
- //=====ASUMSIKAN INI Adalah data dari id=1
- $arrayData=array(
- array('SIC Agito', 'SIC Another Agito', 'SIC Giils', 'SCM Aries', 'SCM Harpy', 'Eagle Marin'),
- array('Alvis & Lavie', 'Figma BRS', ' Nendo Max', 'Racing Miku','Luka'),
- array('Kratos','Spartan IV','Spartan V', 'Master Chief','Ninja')
- );
- $hal=$_POST['hal']-1;
- $show=$arrayData[$hal];
- $s='';
- foreach($show as $v)
- {
- $s.="\n<tr><td>$v</td><td>Rp. xxxxxx</td></tr>";
- }
- $a=array('table'=>$s);
- $json=json_encode($a);
- die($json);
- }
- ?><script src='js/jquery.js'></script>
- <script>
- jQuery(document).ready(function($){
- jQuery.ajax({
- url: "?show=1",
- type: "POST",
- dataType: "json",
- data: "hal=1",
- success: function(data){
- $(".list").append(data.table);
- }
- });
- });
- </script>
- BARANG JUALAN SAYA
- <table class='list'>
- </table>
- Klik angka untuk membuka halaman lain
- <?php
- for($i=1;$i<=3;$i++)
- {
- echo "<a href=# class='viewPage' pos='$i'>$i</a> - ";
- }
- ?>
- <script>
- jQuery( "a.viewPage").click(function()
- {
- $('.viewPage').attr('href', '#');
- $(this).removeAttr('href');
- pos=jQuery(this).attr('pos');
- $(".list").empty();
- jQuery.ajax({
- url: "?show=1",
- type: "POST",
- dataType: "json",
- data: "hal="+pos,
- success: function(data){
- $(".list").append(data.table);
- }
- });
- console.log('page '+pos);
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement