1.     // This .on() needs jquery 1.7 I think.
  2.     $("a.action:not(.remove)").on("click", function (e) {
  3.  
  4.         e.preventDefault();
  5.  
  6.     var obj = $(this),
  7.         objD = obj.data();
  8.  
  9.         if ( !$(this).hasClass('disablelink') ) {
  10.  
  11.             var machineIds = getSelection( obj, objD );
  12.             if ( machineIds.length > 0 ) {
  13.                 packageAction( objD.ajaxPackageid, machineIds, objD.ajaxType );
  14.             };
  15.  
  16.         }
  17.         $(".checkall").attr("checked", false);
  18.  
  19.     });
  20.  
  21. function getSelection( obj, objD ) {
  22.  
  23.     var selected = new Array();
  24.     if ( objD.ajaxMachineId ) {
  25.  
  26.         selected.push( objD.ajaxMachineId );
  27.  
  28.     } else {
  29.    
  30.         $("input.checkbox:checkbox:checked:not(.checkall)").each(function () {
  31.  
  32.             var checkbox = $(this),
  33.         machineId = checkbox.val(),
  34.                 packageId = objD.ajaxPackageid.removeSpecialChars().toUpperCase(),
  35.                 operation = objD.ajaxType;
  36.  
  37.             if ( $("#" + machineId + packageId + "").size() != 0 ) {
  38.  
  39.                 var row = $("#" + machineId + packageId + "");
  40.                 row.has("a[data-ajax-type=" + operation + "]:not(.hide)").length ? selected.push(machineId) : checkbox.attr('checked', false);
  41.  
  42.             }
  43.         });
  44.     }
  45.     return selected;
  46. }  
  47.  
  48.  
  49.     function packageAction(packageId, machineIds, operationType) {