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]');
$('img.voteupImage').live('click', function() {
if (myVoting == 1) {
alert(" you have already voted");
}
else {
value = 1;
}
});
$('img.votedownImage').live('click', function() {
if (myVoting == 0) {
alert(" you have already voted");
}
else {
value = 0;
}
});
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) {
alert("i am inside result here 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]);
}
else
{
alert('U can not vote more than 1');
}
$('#[id$=hfMyVote]').html(result[1]);
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]);
}
else
{
alert('U can not vote down more than 1');
}
}
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("i am inside error");
}
});
}
});
}
$(function() {
manageVoting();
});
i have written above code but when i clicl on image then $.ajax does not executr what's problem in code.