我使用jQuery mobile和html5,我想在我的列表视图(动态)中拥有所选项目的id,并将其发送到detail.php中,请帮助我的^页面srpt try:
output += '<li><a href="#detail" onclick="affichedetail()">'+ field.nom + '</a></li><li>'+field.dist+'KM</li><li><img src="' + './photo/' + field.photo + '" height="100" width="100"</img></li><li>Latitude:' + field.lat + '</li><li>Longitude:' + field.longitude + '</li><li>Aprés:' + delai2 + '</li>';
// alert(var1);
// alert(var2);
});
$('#mosquee').html(output).listview("refresh");
// here we will handle errors and validation messages
});
这是我的网页详情php?requete="
<?php
$con=mysqli_connect("localhost","root","","priere");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result="";
$valeur = $_GET['requete'];
print("id="+$valeur);
$result = mysqli_query($con,"SELECT lat,longitude FROM mosque where id=$valeur");
while( $row = mysql_fetch_array( $result ) ) {
$json[] = $row;
}
//json_encode( $json );
echo json_encode($json);
echo "<table border='1'>
<tr>
<th>lat</th>
<th>Longitude</th>
</tr>";
while($row = mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['lat'] . "</td>";
echo "<td>" . $row['longitude'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysqli_close($con);
?>
我想在我的pagedetail.php中发送所选项目的id,因为in想显示所选项目。我如何知道我在列表视图中选择的id项目,以及如何在url中将其发送到detail.php
为什么不在保存html的"output"变量中包含ID,并将"afschedetail()"函数更改为接受参数,然后可以直接通过afschedetal(ID#)调用它?
此外,如果您使用jQuery,我建议您删除onclick标记,只使用$(".detailClassOfYourChoice").on('click',function(){/您的代码在这里/});