var ratingVal = 0; var ratingText = ''; var currentHash = ''; function fetchRatings(hash) { $.get('prate/' + hash, function(data) { if(typeof(data.rating) !== 'undefined') { ratingVal = data.rating; ratingText = data.rating_text; } buildRatingForm(hash); }); } function doRatings(hash) { fetchRatings(hash); } function buildRatingForm(hash) { var html = '
' + aStr.rating_desc + '
' + aStr.rating_text + '
'; $.colorbox({maxwidth: "50%", maxHeight: "50%", html: html, close: 'X' }); currentHash = hash; } function postRatings() { $.post('prate', $('#ratings_form').serialize(), function(data) { $.colorbox.remove(); $('#edited-' + currentHash).show(); }, 'json'); }