Could you point what is causing this strange behaviour at views Codeigniter's pages?

Eduardo Fuerte
Eduardo Fuerte used Ask the Experts™
on
Hi Experts!

Could you point what is causing this strange behaviour at view Codeigniter's pages?

From a day to another it strangely starts.

The view page is presented at the left page and after a choice is done another view must be presented at the right.

img001
Controller
...
$this->load->view("camaras/ascamaras");

Open in new window


View that presents the left part:

<br/><div id="container_principal">
	<div class="row">
        <h3>As Câmaras </h3><hr class="hr_titulos"/>
		<div class="col-md-12">
         <script type='text/javascript'>
                $(document).ready(function(){
              // Executa o evento CLICK em todos os links do menu
               $('#ascamaras a').live('click',function(){
                // Faz o carregamento da pgina de acordo com o COD da pgina, que vai pegar os valores da pgina page.php.
                $('#camara').load($(this).attr('href'));
                return false;
               });
              });
        </script>
			
			<div class="row font">
				<div class="col-md-4">
					<!--<ul class="list-group" >-->
					<?php
					$table= array(
						'table_open'=> '<table class="table table-hover name="ascamaras" id="ascamaras">',
						'table_close'=>'</table>'
					);
					$this->table->set_template($table);
						foreach($resultadoCamaras as $resultadoCamaras){
							$this->table->add_row(anchor("camarashome/visualizarCamara/$resultadoCamaras->idcategoria",ucwords($resultadoCamaras->nome),"class='links' style='font-size:14px;' id=''"));
						}
						echo $this->table->generate();
					
						echo"<div class='paginacao'>";
						//echo "<br/> $paginacao"; 
						echo "</div>";

					?>
					<!--</ul>-->
                    </td>
                    </table>
				</div>
                <div class="col-md-7" id="camara">
                
                
                </div>
			</div>
		</div>
	</div>
</div>

Open in new window



The second part must be presented at right (and it was)  but instead of it another page is oppened without any configuration.

img002
the view that must to show at the right

	<div id="container_principal">
		        <div class="row font">
		      	   <?php
				 
						foreach($dadosCategoria as $dadosCategoria){
								echo "<div class='col-md-12 '>";
									echo "<h4 class='font'>Câmara Setorial de "; echo ucwords($dadosCategoria->nome); echo"</h4><hr class='as_camaras'/>";
								echo "</div>";	
						
		        			echo "<div class='col-md-6'>";
							echo "<h4  class='font'>Presidente</h4><p>"; echo ucwords($dadosCategoria->presidente);"</p>";
							echo "<h4  class='font'>Endereço</h4>
							<p> Entidade: "; echo mb_strtoupper($dadosCategoria->entidade);
							echo "<br/>Email: $dadosCategoria->email<a href='mailto:";echo $dadosCategoria->email;echo"?subject=Contato C&acirc;mara Setorial'><img src='";echo base_url('assets/img/camaras/mail.jpg'); echo "'border='0' title='contato' alt='Contato' /></a><br/>
							 	"; echo ucwords($dadosCategoria->endereco);echo"<br/>
								CEP: $dadosCategoria->cep<br/>
							 	Telefone:$dadosCategoria->telefonea|
								 $dadosCategoria->telefoneb<br/>
							 
							 </p>
							";
						}
					?>
		        </div>
		        <div class="col-md-5">
		         	<h5  class="font"><b>Atas</b></h5>
					
						<?php
						
							$options = array ('' => 'Selecione uma ata');
							foreach($dadosArquivos as $dadosArquivos){
								$ata= base_url("$dadosArquivos->arquivo");
								$options[$ata] = $dadosArquivos->nome;
								}
							//echo form_dropdown('atas', $options,'','class="atas" id="atas" onchange="document.location.href=this.value" target="_blank"');
							echo form_dropdown('atas', $options,'','class="atas" id="atas" onchange="window.open(this.value)" target="_blank"');
							
							?>
					
		        </div>
					<div class="col-md-10"><br/>
						<h5  class="font"><b>Propostas e Projetos em andamento</b></h5><hr class="as_camaras"/><br/>
                        <ul class="paginacao">
                        <?php 
							foreach($dadosProposta as $dadosProposta){	
								echo "<li style='text-align:justify'>";echo ucfirst($dadosProposta->proposta); echo ".</li>";	
								}
							if($dadosCategoria->idcategoria==12){
								echo "
								<br/><br/>
								<li><a href='"; echo base_url('arquivos/camaras/custo_de_producao_seringueira_cam_tec_12_08.pdf');  echo"'  target='_blank'>Custo de Produção e Rentabilidade da Cultura da Seringueira.(Clique e faça download)</a></li>";
								}
						?>
                        </ul>
					</div>
				</div><br/><br/>
		           <!--<a  href="<?php echo base_url('camarashome/camaras');?> "><img src="<?php echo base_url('assets/img/camaras/voltar.png');?>"></a>--><br/><br/>
		</div>

Open in new window


Could you point what could be done to correct it?

Thanks in advance!
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2018
Distinguished Expert 2018

Commented:
Couple of points I would address. As of jQuery 1.7 live() is deprecated, and it was finally removed in version 1.9, so if you're using a newer version it no longer exists. Use on() instead.

Also, the jQuery way to prevent a link from actually being followed is to use preventDefault() instead of return false. Pass in the event as an argument to your function can call it:

$('#ascamaras').on('click', 'a', function(e){
    e.preventDefault();
    ...
}

Open in new window

Eduardo FuerteDeveloper and Analyst

Author

Commented:
@Cris

Thank you, I received a unexpected demand about Google Analytics - what I really doesn't know how it Works and return back this question asap.
Eduardo FuerteDeveloper and Analyst

Author

Commented:
Just  only substitute like that ?

    <script type='text/javascript'>
                $(document).ready(function(){
              // Executa o evento CLICK em todos os links do menu
               $('#ascamaras a').live('click',function(){
                // Faz o carregamento da pgina de acordo com o COD da pgina, que vai pegar os valores da pgina page.php.
                $('#camara').load($(this).attr('href'));
                

                //return false;

                // EF 2015 Dez02    
                $('#ascamaras').on('click', 'a', function(e){
                e.preventDefault();
              
                
                
               });
              });
        </script>

Open in new window

Most Valuable Expert 2018
Distinguished Expert 2018
Commented:
No. The on() method need to replace your live() method:

$(document).ready(function(){
	$('#ascamaras').on('click', 'a', function(e){
		e.preventDefault();
		$('#camara').load($(this).attr('href'));
	});
});

Open in new window

Eduardo FuerteDeveloper and Analyst

Author

Commented:
Thanks
I will return to complete with another part

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial