Advertisement
Guest User

Untitled

a guest
Feb 6th, 2012
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $(function(){
  2.    var form = $('#hosts'),
  3.        topCheckbox = $('#topcheckbox', form),
  4.        otherCheckboxes = $("input[name^='hosts']", form);
  5.    
  6.    topCheckbox.click(function(){
  7.         otherCheckboxes.prop('checked', this.checked);
  8.    });
  9. });
  10.  
  11. $(function(){
  12.    $('form').submit(function(){
  13.        return false;
  14.    });
  15.    
  16.    $('.button_clicked').click(function(){
  17.       if(this.value == 'processes'){
  18.           var div = $('<div>');
  19.           function getProcesses(){
  20.               $.post(WEBROOT + 'app.php/Job/processes', $(this).parents('form').serialize(), function(data){
  21.                 div.html(data).dialog({
  22.                     title: 'Process List',
  23.                     modal: true,
  24.                     width: 900,
  25.                     height: 325
  26.                 });
  27.                 var div_form = $('form', div).submit(function(){
  28.                     return false;
  29.                 })
  30.                 $('#buttons input:not(:checkbox)', div).click(function(){
  31.                     var formPost = div_form.serialize();
  32.                     if(formPost.length){
  33.                         $.post(WEBROOT + 'app.php/Job/killProcesses', formPost, function(data){
  34.                             if(data.success){
  35.                                 getProcesses();
  36.                             }
  37.                         });
  38.                     }
  39.                     else {
  40.                         alert('nothing to post');
  41.                     }
  42.                 })
  43.             });
  44.           }
  45.          
  46.           getProcesses();
  47.       }
  48.       else {
  49.           alert('insert into db');
  50.       }
  51.    });
  52. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement