euscan-ng/euscanwww/htdocs/js/favourite.js
volpino 9f5402f896 euscanwww: Favourite/Unfavourite template code refactored
* Now is more DRY, the JS code and the HTML code are in one place
* It works even without JS

Signed-off-by: volpino <fox91@anche.no>
2012-11-08 18:57:29 +01:00

24 lines
642 B
JavaScript

$(document).ready(function() {
$(".favourite-form").submit(function(e) {
e.preventDefault();
e.stopPropagation();
$.post($(this).attr("action"), {packages: window.packages}, function() {
$(".unfavourite-button").removeClass("hide");
$(".favourite-button").addClass("hide");
});
return false;
});
$(".unfavourite-form").submit(function(e) {
e.preventDefault();
e.stopPropagation();
$.post($(this).attr("action"), {packages: window.packages}, function() {
$(".favourite-button").removeClass("hide");
$(".unfavourite-button").addClass("hide");
});
return false;
});
});