Hi. I want to load a table by a parameter something like this
Hi. I want to load a table by a parameter something like this
 Hildeb67            
            
                Posts: 85Questions: 23Answers: 1
Hildeb67            
            
                Posts: 85Questions: 23Answers: 1            
            $(document).ready(function() {
$(document).on("click", "#anzeigekw", function () {
    var kw = document.getElementById("kwoche").value;
$.ajax( {
  url: './controllers/testcontroller.php',
  type: "POST",
  dataType: 'json',
  data: { kw: kw }
    } );
    .... the i want to load the Table
} );
testcontroller.php
<?php
include("../lib/DataTables.php" );
require_once 'index.php' ;
$action = $_REQUEST['action'];
session_start();
if ($action == "getkw") {
   $kw = (!empty($_GET['kw'])) ? $_GET['kw'] : '';
}
use
    DataTables\Editor,
    DataTables\Editor\Field,
    DataTables\Editor\Format,
    DataTables\Editor\Mjoin,
    DataTables\Editor\Options,
    DataTables\Editor\Upload,
    DataTables\Editor\Validate,
    DataTables\Editor\ValidateOptions;
$editor = Editor::inst( $db, $kw )
    ->fields(
        Field::inst( 'Klasse' ),
        Field::inst( 'KNachname' ),
        Field::inst( 'KVorname' ),
        Field::inst( 'Mo_geht' )
            ->validator( Validate::notEmpty( ValidateOptions::inst()
                ->message( 'Bitte Uhrzeit eingeben' )
            ) )
                    ->validator( 'Validate::dateFormat', array(
                "format"  => ( 'H:i' ),
                'message' => 'Uhrzeit nicht gültig'
                ) ),
        Field::inst( 'Mo_mitbus' )
            ->setFormatter( function ( $val, $data, $opts ) {
                return ! $val ? 0 : 1;
            } ),
        Field::inst( 'Mo_bus' )
            ->validator( Validate::notEmpty( ValidateOptions::inst()
                ->message( 'Bitte Uhrzeit eingeben' )
            ) )
                    ->validator( 'Validate::dateFormat', array(
                "format"  => ( 'H:i' ),
                'message' => 'Uhrzeit nicht gültig'
                ) ),
        Field::inst( 'Mo_mitessen' )
            ->setFormatter( function ( $val, $data, $opts ) {
                return ! $val ? 0 : 1;
            } ),
        Field::inst( 'Mo_haus' )
            ->setFormatter( function ( $val, $data, $opts ) {
                return ! $val ? 0 : 1;
            } )
)
->debug(true)   
->process( $_POST )
->json();   
can someone help me?
Thanks
Answers
Looks like you are using jQuery ajax() to fetch the data. Use the
successfunction to initialize and load the data using thedataoption.Kevin