When i execute it in firefox mozila than this code is working well (in case of register user) but when we try it in IE (iternet explorer 8) then alert("sorry u must have to login first"); this message is comming. ( in both cases as register or gest).
当我在firefox mozila中执行它比这个代码运行良好(如果是注册用户)但是当我们在IE(iternet explorer 8)中尝试它然后警告(“抱歉,你必须先登录”);这条消息即将到来。 (在两种情况下都是注册或手势)。
Another thing: for gest user returning data from server is null. means d = null,
另一件事:对于从服务器返回数据的gest用户为空。意味着d = null,
Another thing when execute in firefox mozila as a gest user then nothing happen means alert("sorry u must have to login first"); this message is not comming.
另一件事是在firefox mozila中作为一个用户执行时没有任何事情发生意味着警告(“抱歉,您必须先登录”);这条消息没有来临。
What should i do?
我该怎么办?
function manageVoting() {
var parameter;
var myVoting;
var divVoting;
var divVotes;
var value = -1;
var parameterData;
$('div.votemaincontainer').each(function() {
parameter = $(this).find('#[id$= hfUrl]').val();
myVoting = parseInt($(this).find('#[id$=hfMyVote]').val());
divVoting = $(this).find('[id$=divVoting]');
divVotes = $(this).find('[id$=divVotes]');
function processVote(value) {
if (value == 0 || value == 1) {
parameterData = parameter + value + "'}";
$.ajax({
type: 'POST',
url: 'UserControls/Vote/VoteAction.aspx/Voting',
data: parameterData,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(data) {
var result = eval(data.d);
if (result) {
if (result.length > 1) {
if (result[1] == 1 && result[2] == 1) {
$('img.voteupImage').attr('src', 'UserControls/Vote/Images/aftervote_arrow_up.png');
$('img.votedownImage').attr('src', 'UserControls/Vote/Images/arrow_down.png');
$('div.divVotes').html(result[0]);
$(myVoting).val(value);
}
else if (result[1] == 0 && result[2] == 1) {
$('img.voteupImage').attr('src', 'UserControls/Vote/Images/Arrow Up.png');
$('img.votedownImage').attr('src', 'UserControls/Vote/Images/aftervote_down.png');
$('div.divVotes').html(result[0]);
$(myVoting).val(value);
}
else if (result[2] < 0 && value == 0) {
alert('U HAVE ALL READY VOTED DOWN');
}
else {
alert('U HAVE ALL READY VOTED UP');
}
$('#[id$=hfMyVote]').html(result[1]);
}
else {
alert('I AM ENSIDE ELSE');
//$('div.divVotes').html(result[0] - 1);
alertDialog("Rating any knowledge item is only available for Registered User.<br>Do you want to <a class='signUpPopUp' href='signup.aspx'> signup</a> Now?");
}
}
},
error: function() {
alert("sorry u must have to login first");
}
});
}
}
$('img.voteupImage').live('click', function() {
value = 1;
processVote(value);
});
$('img.votedownImage').live('click', function() {
value = 0;
processVote(value);
});
});
}
$(function() {
manageVoting();
});
1 个解决方案
#1
0
For the ajax call to be successful or not does not depend on the user being authenticated. The http server should return a 403 code if the user is not authenticated and 200 if everything is ok.
对于ajax调用是否成功不依赖于正在进行身份验证的用户。如果用户未经过身份验证,http服务器应返回403代码,如果一切正常,则返回200。
success(data, textStatus, XMLHttpRequest){
if (XMLHttpRequest.status == 403){
alert("sorry u must have to login first");
return;
}
}
#1
0
For the ajax call to be successful or not does not depend on the user being authenticated. The http server should return a 403 code if the user is not authenticated and 200 if everything is ok.
对于ajax调用是否成功不依赖于正在进行身份验证的用户。如果用户未经过身份验证,http服务器应返回403代码,如果一切正常,则返回200。
success(data, textStatus, XMLHttpRequest){
if (XMLHttpRequest.status == 403){
alert("sorry u must have to login first");
return;
}
}