$(document).ready(function() {
$('a#fav').bind('click', addFav(<?php echo $showUP["uID"]; ?>));
});
$(document).ready(function() {
$('a#fav').bind('click', addFav);
});
我加(<?php echo $showUP["uID"]; ?>)
因爲我希望用戶profile's ID與在addFav Ajax調用工作。
所以我有這在我的網頁的底部,現在即使我havnt點擊了#fav它運行它?但它不中的情況下運行本身時,我沒有這個(ID)
繼承人addFav:
function addFav(id){
$.ajax({
url: "misc/favAdd.php",
data: { id: id},
success: function(){
$('a#fav')
.addClass('active')
.attr('title','[-] Remove as favorite')
.unbind('click')
.bind('click', removeFav(id))
;
jGrowlTheme('wallPop', 'mono', '[+] Favorit', 'Du har nu lagt till denna profil som favorit', 'images/addFavorit_hover2.png', 1000);
}
});
}
function removeFav(id){
$.ajax({
url: "misc/favRemove.php",
data: { id: id },
success: function(){
$('a#fav')
.removeClass('active')
.attr('title','[+] Add as favorite')
.unbind('click')
.bind('click', addFav(id))
;
jGrowlTheme('wallPop', 'mono', '[-] Favorit', 'Du har nu tagit bort denna profil som favorit', 'images/addFavorit_hover2.png', 1000);
}
});
}