Привет: прямо в точку.
Я пытаюсь передать строку JSON из вызова AJAX в качестве источника данных
Код PHP
if($_POST){
$action = $_POST["action"];
if($action == "call_data"){
header('Content-type: application/json');
include_once 'clases/Usuario.class.php';
$usuario = new Usuario;
$resultado = $usuario->listar_jefes ();
if ( ! $resultado )
{
exit ("nok");
}
exit (json_encode ($resultado));
}
}
И мой код JQuery.
$.post("function.php", {action:"call_data"},function(jsonstr){
$("#usr_table").dataTable({
"bProcessing": true,
"sAjaxSource": jsonstr
});
});
Но это не работает ... любая помощь будет оценена
РЕДАКТИРОВАТЬ: я ставлю свой стол ... на всякий случай:
<table id="usr_table">
<thead>
<tr>
<th>col1</th>
<th>col2</th>
<th>col3</th>
</tr>
</thead>
<tbody>
<tr>
</tr>
</tbody>
<tfoot>
<tr>
<th>col1</th>
<th>col2</th>
<th>col3</th>
</tr>
</tfoot>
</table>