var on_ajax = false;
$(document).ready(function() {
$.ajax({
type: 'POST',
url: 'http://www.innatia.com/scripts/ajax.php',
data: 'a=articulos_votacion_get_vote&p=propiedades-del-zumo-de-limon-en-ayunas-7000',
success: function(result)
{
res = eval('('+result+')');
if (res["success"] == 1)
$("#valoracion_score").html('(Puntos: '+res["r"]+'; votos: '+res["q"]+')');
else
$("#valoracion_score").html('Hubo un error obteniendo el puntaje');
}
});
$(".votacion").click(function() {
if (on_ajax) return false;
on_ajax = true;
var tmp = $(this).attr("id").split("_");
var value = tmp[1];
$.ajax({
type: 'POST',
url: 'http://www.innatia.com/scripts/ajax.php',
data: 'a=articulos_votacion_add_vote&p=propiedades-del-zumo-de-limon-en-ayunas-7000&v='+value,
success: function(result)
{
res = eval('('+result+')');
on_ajax = false;
if (res["success"] == 1)
$("#valoracion").html('Gracias por votar! (Puntos: '+res["r"]+'; votos: '+res["q"]+')');
else
$("#valoracion").html('Hubo un error al momento de votar');
}
});
});
});