$(document).ready(function() { $("a").each( function () { if ($(this).is("a:.usernotes-voteu") || $(this).is("a:.usernotes-voted")) $(this).click( function (event) { event.preventDefault(); var url = $(this).attr("href"); var id = url.match(/\?id=(\d+)/)[1]; var request = $.ajax({ type: "POST", url: url, dataType: "json", headers: {"X-Json": "On" }, beforeSend: function() { $("#Vu"+id).hide(); $("#Vd"+id).hide(); $("#V"+id).html(""); } }); request.done(function(data) { if(data.success != null && data.success == true) { $("#V"+id).html("
" + data.update); } else { var responsedata = "Error :("; if (data.msg != null) { responsedata = data.msg; } $("#V"+id).html(""); } }); request.fail(function(jqXHR, textStatus) { $("#Vu"+id).show(); $("#Vd"+id).show(); $("#V"+id).html(""); }); request.always(function(data) { $("#V"+id).fadeIn(500, "linear"); }); } ); } ); if (window.location.href.match(/#\d+$/)) { var highlightId = window.location.href.match(/#(\d+)$/); highlightId = highlightId[1]; $("#Hcom"+highlightId).effect("highlight", {}, 3000); } });