Welcome Guest, Not a member yet? Register   Sign In
Element.Update scriptaculos issue :S
#1

[eluser]Peter74[/eluser]
Hi all! learning ci a couple of weeks.. almost ready for start my first proyect, before i want learn ajax, y read the documentation from the site, and learn with Derel Allard and iam try to Update one segment of the page but dont work..
look at this
please Big Grin

Code:
myfunc.js
window.onload = function(){
    $('mainmenu').onclick = function(){
    //new Element.update('contenido','static content');    //this work
    new Element.update('contenido', base_url+'contenido/menu');  //dont work
    return false;
    }
}
i think i need to know, how to put a "variable" in the second parameter of the function element.update
Code:
contenido.php
<?php
class Contenido extends Controller{
function index(){
    echo "estoy en contenido :D";
}
function menu(){
   $select = $this->uri->segment(3);
   //this is ok, i load the content of the file... (menu choosen)
   $data['contenido'] = $this->load->view('segmentos/'.$select.'_inc.php', '', true);
   //echo $data['contenido'];                          i try with this, no work
   //echo $this->input->post($data['contenido']);      i try with this, no work
   //return $data['contenido'];                        i try ...
    }    
}
the view
<?php
    $this->load->view('header');
?>
    <div id="contenido" class="fila">
    &lt;?php echo $contenido; ?&gt;        
    </div>
&lt;?php
    $this->load->view('footer');
?&gt;

Any help or sugestion helpe a lot, very txs for reading and reply Big Grin
#2

[eluser]Peter74[/eluser]
i found some mistakes and now the problem is
new Element.update('contenido', base_url+'contenido/menu');

base_url is not defined
#3

[eluser]chreestopher[/eluser]
I have had the same problem. I found this declared on the page and it fixed my problem. works great now.
Code:
//&lt;![CDATA[
base_url = '&lt;?=site_url();?&gt;';
//]]>

Thanks for the tutorial




Theme © iAndrew 2016 - Forum software by © MyBB