tags:

views:

74

answers:

4

I usually go to the news of the story expanded, passes the variable with a while, as follows:

while ($noticias = @mysql_fetch_array($sql)) {
$sqll = mysql_query("SELECT * FROM categorias WHERE id='".$noticias['categoria']."'");
$datos = mysql_fetch_array($sqll);
<div class="leermas">[COLOR="red"]<a href="noticias.php?n='.$noticias['id'].'">[/COLOR]<strong>(Leer m&aacute;s)</strong></a></div>
</div></div>';

}

but now I want is to load the content of the page in a div and I usually when I don't have to pass php variable in this way: the link for load content

<a  class="recursostopwebjqampliada" href="">

jQuery code that I have it in an external file called load.js

$(document).ready(function() {  
    $(".recursostopwebjqampliada").live("click", function(){ 

$("div#main2").load("topwebjq_ampliada.php?n='.$noticias['id'].'");//AQUI DONDE ESTA LA VARIABLE
     });  
 });

and the page that loads the div I get the variable as follows:

$id = $_GET['n'];  

the problem is that jQuery does not read the file php load.js then how I can fix it

load("topwebjq_ampliada.php?n='.$noticias['id'].'"
A: 

I see load.js php does not read, because she ignores him

?n='.$noticias['id'].'

then I want to fix that

chiqui3d
Please be sure to add your comments by editing your original post, or adding a comment to another answer or your question - this section is intended for answers/solutions to the question.
Mark Snidovich
A: 

You have to print out the PHP variable inside opening and closing PHP tags like so:

$("div#main2").load("topwebjq_ampliada.php?n=<?php echo $noticias['id']; ?>");

Now when the page is rendered, you should view the source and see:

$("div#main2").load("topwebjq_ampliada.php?n=12345");

Edit: Okay, I just noticed that that javascript is in a .js file. You're going to need to move your jQuery code to the file where $noticias['id'] is set so that you can print it out.

mrinject
thank you very much but I do not load the content div, it is but when I click on the link does nothing. It works when I put directly n = 50, but not topwebjq_ampliada.php?n=<?php echo $noticias['id']; ?>
chiqui3d
the put the jquery code within the while, he shows me the news but the news is not shown, gives me random, for example I click on the link id is 50 and shows me the ID 46ListenRead phonetically
chiqui3d
A: 

the put the jquery code within the while, he shows me the news but the news is not shown, gives me random, for example I click on the link id is 50 and shows me the ID 46 Listen Read phonetically

chiqui3d
A: 

the put the jquery code within the while, he shows me the news but the news is not shown, gives me random, for example I click on the link id is 50 and shows me the ID 46 Listen Read phonetically – chiqui3d 16 hours ago

chiqui3d