Blame view

js/extra.js 1.09 KB
1ccf6db7   andryeyev   + класс Extra для...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
     
      function extraAction ($array)
      {  
          $.ajax({
              type: 'GET',
              url: '/ajax/extra.php',
              dataType: 'json', 
              data: $.param ($array['json']),
              success: function (response)
              {
                  switch ($array['json']['jaction']) 
                  { 
                      case 'extra': 
                      	 
                      	modalBoxLoad (response.html, {
                      		autoClose: 800, 
                      	}); 
                  		break;
                  }
              },
              error: function()
              {
              	modalBoxLoad ('×òî-òî ïîøëî íå òàê...');
              }  
          });
          
      }
  
  $(function() 
  {
      $(".switch").bootstrapSwitch(
      {    
          onSwitchChange: function(event, state) 
          { 
              extraAction ({
                  'json': {
                      'jaction': 'extra',
                      'status_id': state === false ? 0 : 1,
                      'extra_id': $(this).closest('.line').attr('id').replace('extra-', ''),
                  }
              });  
          }
      });
  });