[英]jq tounch id attar occuring twice
$('#news_details').bind('pageAnimationEnd', function (e, info) {
// get the id of the calling href
//alert('we are here');
var id = $(this).data('referrer')[0].id;
//alert(id);
$.get('http://localhost/school_app/admin/json/news_pagination.php?id=' + id, function (data) {
// do something with the data
//alert(data);
$('#detail_news').append(data);
//alert('we are here');
});
});
我正在獲取此ID並將其傳遞到#news_details頁面,它是成功的,但是當我喜歡該頁面時,腳本本身就是原子發生的。當我進入#new_detail頁面時,另一個id var之前的數據仍然存在。
請幫我。
$('#news_details').bind('pageAnimationEnd', function (e, info) {
// get the id of the calling href
//alert('we are here');
var id = $(this).data('referrer')[0].id;
//alert(id);
$.get('http://localhost/school_app/admin/json/news_pagination.php?id=' + id, function (data) {
// do something with the data
//alert(data);
$('#detail_news').html(data);
//alert('we are here');
});
});
而不是使用$('#detail_news')。append(data);
使用$('#detail_news')。html(data);
它會工作....
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.