我希望能夠顯示一條消息,如果用戶沒有登錄,如果他們嘗試通過點擊評級對用戶進行評級。有沒有辦法將它添加到我的JQuery代碼下面,或者我可以將它傳遞給我的PHP腳本?有沒有辦法檢查用戶是否使用JQuery登錄?
我正在使用PHP
這是JQuery代碼。
$('#rate li a').click(function(){
$.ajax({
type: "GET",
url: "http://localhost/update.php",
data: "rating="+$(this).text()+"&do=rate",
cache: false,
async: false,
success: function(result) {
// remove #ratelinks element to prevent another rate
$("#rate").remove();
// get rating after click
getRating();
getRatingAvg();
getRatingText2();
getRatingText();
},
error: function(result) {
alert("some error occured, please try again later");
}
});
送東西從那裏回來?請原諒我的無知。 – jphp 2010-08-05 08:00:51
請參閱Reigels的答案。他提供了一個更完整的答案。 – ZeissS 2010-08-05 09:57:22