Using jQuery with json - i keep having "ui is undefined"
I have a link (#botaoMovimentos) and, by pressing, it returns data from mysql.
The sql query is ok. I've tested. But i keep getting this error (ui is undefined).
What is missing in here?
#tabelamovimentos is a Div with a table.
#botaoMovimentos is a link that redirects to #.
I have the index.php file with this code;
- $('#botaoMovimentos').bind( {
- source : 'ajaxMovimentos.php',
- click: function(event, ui) {
- $('#tabelamovimentos').slideUp('slow', function(){
- $('#tabelamovimentos').html(
- '<h2>Detalhes do Colaborador</h2>' +
- '<strong>Date: </strong>' + ui.item.date + '<br/>' +
- '<strong>Name: </strong>' + ui.item.name + '<br />' +
- '<strong>Address: </strong>' + ui.item.adress + '<br />'
- );
- });
- $('#tabelamovimentos').slideDown('slow');
- }
- })
in ajaxMovimentos.php i have:
- <?php
- include_once 'usuarios.class.php';
- $movimento = new Colaboradores();
- echo json_encode($movimento->buscarMovimentos($_GET['term']));
- ?>
in usuarios.class.php i have:
- public function buscarMovimentos($movimento){
- $dados_mov = array();
- $sql_movimentos = "SELECT * FROM movimentos WHERE colaborador_id = 471 LIMIT 1";
-
- $resultado_movimentos = mysql_query($sql_movimentos);
-
- while ($row_mov = mysql_fetch_array($resultado_movimentos, MYSQL_ASSOC)){
- $dados_mov[] = array("date"=> htmlentities($row_mov['date']),
- "name" => htmlentities($row_mov['name']),
- "address"=> htmlentities($row_mov['address'])
- );
- }
- return $dados_mov;
- }