4
I have a div
that will receive the content, I have a vertical menu, which will define the content that the guy will see. The problem is that it does the .load()
of the file, but it loads as far as appears
I tried for the .html()
, and put a include
.php
, it even does, but gives the same problem. It does not read the information after PHP. I tried to write the page inside the .html()
, but it also doesn’t work, I made double quote corrections with backslash ( ") and it didn’t work.
In the official libraries I could not get an answer if the case is with Database and PHP. but I can not understand, why does not work.
My code is a little big, because there are several links and the contents are extensive, I made a reduced example, because I think the problem is concept, not syntax.
The problem is not in PHP and Mysql, because if I open the page only, outside of jQuery, it works smoothly, takes all the data.
The jQuery database and Mysql connection are already being made and work, not put to fill with useless code.
jQuery:
<script type="text/javascript">
$(document).ready(function() {
$("#link1").click(function() {
$("#conteudo").html("Aqui vai o conteúdo do Link 1, via HTML mesmo, pois não tem PHP.. Esse aqui funciona normalmente!");
});
$("#link2").click(function() {
$("#conteudo").load('link2.php');
});
});
</script>
HTML
<a href="#link1" id="link1">Link 1</a>
<a href="#link2" id="link2">Link 2</a>
<div id="conteudo">Este conteúdo é para ser alterado, conforme o usuário vá clicando no link... O link 1 funciona normal, pois não tem php, o link 2 funciona até aparecer o PHP...</div>
PHP (Link2.php)
<?php
$query = @mysql_query("SELECT * FROM dados;");
while($linha = @mysql_fetch_array($query)) { ?>
<p><?php echo $linha['nome']. " - ". $linha['sobrenome']; ?>
<a href="imagens/foto.jpg">Veja a foto</a>
</p>
<?php } ?>
In Link2.php you are not opening the database, can you connect?? , and don’t use @ to omit errors remove this, it is not loading anything because it has no active connection in the code snippets
– user6026
I already made the connection in a require on the page that will include... I did not put in the code because I thought it would be bullshit... I really don’t even know why I put that @.. I’m going to pull it out to see what happens..
– Luther
Please post the whole page we can watch what is really happening ... !!! @ means bug defaults ... gave error does not show !!! (use in well defined cases)
– user6026