更新时间:2023-12-05 10:48:40
<脚本>
功能getSummary(id)的
{
$阿贾克斯({
键入:GET,
网址:你的URL,
数据:ID =+ ID,//显示为$ _GET ['身份证'] // @你的后端侧
成功:功能(数据){
//数据是UR汇总
$('#摘要)HTML(数据)。
}
});
}
< / SCRIPT>
和增加的onclick
事件在你的名单
< A HREF =JavaScript的:无效(0);类=电影的onclick =getSummary(1)>名称电影和LT的; / A>
I have a div which contains some text for the database:
<div id="summary">Here is summary of movie</div>
And list of links:
<a href="?id=1" class="movie">Name of movie</a>
<a href="?id=2" class="movie">Name of movie</a>
..
The process should be something like this:
<script>
function getSummary(id)
{
$.ajax({
type: "GET",
url: 'Your URL',
data: "id=" + id, // appears as $_GET['id'] @ your backend side
success: function(data) {
// data is ur summary
$('#summary').html(data);
}
});
}
</script>
And add onclick
event in your lists
<a href="javascript:void(0);" class="movie" onclick="getSummary(1)">Name of movie</a>