0
我在這段代碼中有條件的這個問題。 代碼工作正常,除了行。jQuery AJAX Post - 大於條件不能正常工作
<if condition="$show['member']">
<script type="text/javascript" >
$(function() {
$("#submitbutton$post[postid]").click(function() {
var username = $("#username_$post[postid]").val();
var reputationamount = $("#amount_$post[postid]").val();
var dataString = 'username='+ username + '&reputationamount=' + reputationamount;
if(username == '' || reputationamount == '') {
$('.errorsameuser_$post[postid]').hide();
$('.errorreputation_$post[postid]').hide();
$('.errorempty_$post[postid]').fadeIn(200);
} else if (username == '$bbuserinfo[username]') {
$('.errorempty_$post[postid]').hide();
$('.errorreputation_$post[postid]').hide();
$('.errorsameuser_$post[postid]').fadeIn(200);
} else if (reputationamount >= '$bbuserinfo[reputation]' || reputationamount <= '0') {
$('.errorempty_$post[postid]').hide();
$('.errorsameuser_$post[postid]').hide();
$('.errorreputation_$post[postid]').fadeIn(200);
} else {
$.ajax({
type: "POST",
url: "donaterep.php",
data: dataString,
success: function(){
$('.errorempty_$post[postid]').hide();
$('.errorsameuser_$post[postid]').hide();
$('.errorreputation_$post[postid]').hide();
$('#donaterepbox_$post[postid]').fadeOut();
$('.success_$post[postid]').fadeIn(500);
}
});
}
return false;
});
});
</script>
這部分是不工作:
否則,如果(reputationamount> '$ bbuserinfo [口碑]' || reputationamount < = '0'){
$('.errorempty_$post[postid]').hide();
$('.errorsameuser_$post[postid]').hide();
$('.errorreputation_$post[postid]').fadeIn(200);
}
reputationamount =什麼用戶輸入。 (例如:5) $ bbuserinfo [聲望] =捐贈人的代表點數。 (實施例:4)
所以我們可以說這是..
如果(5> 4 || 5 < = '0'){
$( 'errorreputation_ $訊息[帖子ID') .fadeIn(200);
}
應該拋出錯誤,而是它運行的ajax開機自檢。
幫助?
其他條件工作正常。
沒有它evalute甚至字符串檢查http://jsfiddle.net/suhailvs/yXJtU/ – suhailvs
@suhail在這兩種情況下的一側是一個數試'「5」 <「25''代替'5 <」 25'或'5'<25' –
例如:http://jsfiddle.net/arunpjohny/KVhY2/1/ –