0
我使用Ajax來傳遞JSON數據,但實際上有一個問題。使用ajax打印php頁面
我想將我的頁面的php轉到其他頁面,並且只能用ajax打印。
PHP的:
<ul class="thumbnails biblio sortable">
<?php
$reponse = $bdd->query("SELECT id_gallery,nom_gallery,link_gallery,img_gallery
FROM gallery where id_gallery='$gallery'");
$donnees = $reponse->fetchAll();
for($k=0;$k<count($donnees);$k++){
$id_gallery=$donnees[$k]['id_gallery'];
$nom_gallery=$donnees[$k]['nom_gallery'];
$link_gallery=$donnees[$k]['link_gallery'];
$img_gallery=$donnees[$k]['img_gallery'];
$link_gallery = explode(",", $link_gallery);
$longueur=count($link_gallery);
//echo "longueur: ".$longueur;
for($j=0;$j<$longueur;$j++){
$id=$link_gallery[$j];
$reponse = $bdd->query("SELECT nom_fichier,id_fichier
FROM fichier
where id_fichier = '$id' ");
$donnees = $reponse->fetchAll();
if(count($donnees) != 0){
$nom_fichier=$donnees[0]['nom_fichier'];
$id_fichier=$donnees[0]['id_fichier'];
if($j % 4 == 0 && $j !=0){
echo"</ul>";
echo"<ul class='thumbnails biblio sortable'>";
}
//if($)
echo"<li class='span3 ui-state-default info' style='overflow:hidden;' data-click='".$id_fichier."'>";
//str+="<input id='"+data[i].id_gallery +"' type='checkbox' value='option'>";
echo"<ul class='thumbnail-actions'>";
echo"<li><a href='#' title='Edit photo'><span class='icon-pencil'></span></a></li>";
//str+="<li><a href='upload/download.php?filename="+dataSplited[i].nom_fichier+"' title='Download photo'><span class='icon-download'></span></a></li>";
echo"<li><a class='delete' id='href-".$id_fichier."' href='".$nom_fichier."' data-click='".$id_fichier."' title='Delete photo'><span class='icon-trash'></span></a></li>";
echo"</ul>";
echo"<a class='thumbnail' href='#' ><img alt='Image 34' src='upload/uploads/".$nom_fichier."' style='width:200px;height:200px;' ></a>";
echo"</li>";
}
}
}
?>
</ul>
的問題是,我不知道如何打印所有的「回聲」。
你在尋找類似的東西嗎?http://demo.tutorialzine.com/2009/09/simple-ajax-website-jquery/demo.html#page1 – 2013-03-20 04:15:40