[eluser]firexas[/eluser]
anyone help me i'm stackoverlow..
i'm build a mobile web with jquery mobile for client side and codeigniter for server side + mysql.
why can't search for my search form?
this my code :
Code: //Controller
function caribio()
{
$cari = $this->input->post('cari');
// Offset
$uri_segment = 3;
$offset = $this->uri->segment($uri_segment);
// Load data
$biologis = $this->biologis_model->get_all($this->limit, $offset);
$num_rows = $this->biologis_model->count_all();
if ($num_rows > 0)
// Generate pagination
$config['base_url'] = site_url('mobile/caribio');
$config['total_rows'] = $num_rows;
$config['per_page'] = $this->limit;
$config['uri_segment'] = $uri_segment;
$this->pagination->initialize($config);
$data['pagination'] = $this->pagination->create_links();
$query=$this->biologis_model->cari($cari);
$hasil=$query->result();
$num_rows=$query->num_rows();
$tmpl = array( 'table_open' => '<table border="0" cellpadding="0" cellspacing="0">',
row_alt_start' => '<tr class="zebra">',
'row_alt_end' => '</tr>'
);
$this->table->set_template($tmpl);
$this->table->set_empty(" ");
$this->table->set_empty(" ");
$this->table->set_heading('Nama Biologi','Isi');
if ($num_rows > 0){
foreach($hasil as $row)
{
$this->table->add_row($row->nmbio, $row->isi);
}
$data['table'] = $this->table->generate();
}
else {
$this->session->set_flashdata('message', 'data tidak ditemukan!');
}
$this->load->view('mobile', $data);
}
}
//Model
function get_all($limit, $offset)
{
$this->db->query('SELECT * FROM biologis');
$this->db->from($this->table);
$this->db->limit($limit, $offset);
$this->db->order_by('idbio', 'asc');
return $this->db->get()->result();
}
function count_all()
{
return $this->db->count_all($this->table);
}
function cari($cari)
{
$this->db->like('nmbio', $cari);
return $this->db->get('biologis');
}
//views
<!DOCTYPE html>
<html>
<head>
<title>Mobile wiki biologi</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="stylesheet" href="<?php echo base_url('asset/mobile/lib/jquery.mobile-1.0.min.css');?>" />
<link rel="stylesheet" href="<?php echo base_url('asset/mobile/mobile.css');?>" />
[removed][removed]
< type="text/javascript" src="<?php echo base_url('asset/mobile/mobile.js');?>">[removed]
< type="text/javascript" src="<?php echo base_url('asset/mobile/lib/jquery.mobile-1.0.min.js');?>">[removed]
< type="text/javascript" src="<?php echo base_url('asset/mobile/lib/jquery-ui-1.8.10.custom.min.js');?>">[removed]
</head>
[removed]
var site = "<?php echo site_url();?>";
[removed]
<body>
<?php
echo form_open('','name="f_caribio"');
?>
<input type="text" name="cari" data-inline="true">
<input name="submit" id="submit" type="submit" value="search" data-inline="false">
</form>
//mobile.js
function cari_bio(){
var formObj = document.f_caribio;
$.ajax({
url: site+"/mobile/caribio",
data: $(formObj.elements).serialize(),
beforeSend:function(){
$.mobile.showPageLoadingMsg();
},
success:function(response){
$.mobile.hidePageLoadingMsg();
$('#login_error').html(response);
location = site+"/mobile";
},
type: "post",
dataType: "html"
});
return false;
}
i'm very stackoverflow and confuse why can't running?
help me..thanks b4 and sory my english not good.
[eluser]pbflash[/eluser]
This line:
row_alt_start' => '<tr class="zebra">',
Should be:
'row_alt_start' => '<tr class="zebra">',
Not sure if that is causing your problem.
[eluser]InsiteFX[/eluser]
You are missing the single qoute on the row_alt_start!
Code: $tmpl = array(
'table_open' => '<table border="0" cellpadding="0" cellspacing="0">',
'row_alt_start' => '<tr class="zebra">',
'row_alt_end' => '</tr>'
);
Also you should be setting the whole table template like this:
Code: $tmpl = array(
'table_open' => '<table border="0" cellpadding="0" cellspacing="0">',
'thead_open' => '<thead>',
'thead_close' => '</thead>',
'heading_row_start' => '<tr>',
'heading_row_end' => '</tr>',
'heading_cell_start' => '<th>',
'heading_cell_end' => '</th>',
'tbody_open' => '<tbody>',
'tbody_close' => '</tbody>',
'row_start' => '<tr>',
'row_end' => '</tr>',
'cell_start' => '<td>',
'cell_end' => '</td>',
'row_alt_start' => '<tr class="zebra">',
'row_alt_end' => '</tr>',
'cell_alt_start' => '<td>',
'cell_alt_end' => '</td>',
'table_close' => '</table>'
);
[eluser]firexas[/eluser]
[quote author="pbflash" date="1327884142"]This line:
row_alt_start' => '<tr class="zebra">',
Should be:
'row_alt_start' => '<tr class="zebra">',
Not sure if that is causing your problem. [/quote]
[quote author="InsiteFX" date="1327886061"]You are missing the single qoute on the row_alt_start!
Code: $tmpl = array(
'table_open' => '<table border="0" cellpadding="0" cellspacing="0">',
'row_alt_start' => '<tr class="zebra">',
'row_alt_end' => '</tr>'
);
Also you should be setting the whole table template like this:
Code: $tmpl = array(
'table_open' => '<table border="0" cellpadding="0" cellspacing="0">',
'thead_open' => '<thead>',
'thead_close' => '</thead>',
'heading_row_start' => '<tr>',
'heading_row_end' => '</tr>',
'heading_cell_start' => '<th>',
'heading_cell_end' => '</th>',
'tbody_open' => '<tbody>',
'tbody_close' => '</tbody>',
'row_start' => '<tr>',
'row_end' => '</tr>',
'cell_start' => '<td>',
'cell_end' => '</td>',
'row_alt_start' => '<tr class="zebra">',
'row_alt_end' => '</tr>',
'cell_alt_start' => '<td>',
'cell_alt_end' => '</td>',
'table_close' => '</table>'
);
[/quote]
@pbflash and InsiteFX : my problem not like that.
my problem can't process for searching result..?
confirm my problem "Error Loading page" on my UI.
|