I was wondering if anyone had any good tutorials around creating a gmail inbox star (favorite) ?
EDIT:
I guess I want to create something just like the stackover
I'm assuming you want less of a "rating" system (as mentioned in the other answers) and more of a "add this to favorites" system?
Something like this should get you started in the right direction. Others, feel free to chime in with other best-practices if you have them.
(function($){
$.fn.make_favorite = function(){
var callback = function(response){
console.log(response);
};
return this.each(function(){
$(this).click(function(){
var params = {
item_type: $(this).attr('href').match(/\w+/)[0], // 'article'
item_id: $(this).attr('href').match(/\d+/)[0] // 15
};
$.post('/favorite.php', params, callback, 'json');
// stop event propagation
return false;
});
});
};
})(jQuery);
true, 'message' => 'Huzza!');
}
else {
$response = array('ok' => false, 'message' => mysql_error());
}
// the magic?
echo json_encode($response);
?>