Blame view

resources/js/site.js 1.9 KB
ea1a19bc   Yarik   Testing
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
  $(
      function()
      {
  
          var iii = true;
  
          $('body').on(
              'click', '.btn-warning', function()
              {
  
                  var testt = $(this);
  
                  var id = $(this).attr('id');
  
                  var ddd = document.getElementById('test_tr_class');
  
                  // $.post( "index.php?r=order%2Fupdate&id=1", function( data ) {
  
                  if(!ddd)
                  {
  
                      testt.closest('tr').after(
                          '<tr id="test_tr_class">' + '<td colspan="12" id="content_' + id + '">' + 'data' + '</td>' + '</tr>'
                      );
  
                      loadShow(testt, id);
  
                  } else
                  {
                      document.getElementById('test_tr_class').remove();
                  }
                  ;
  
                  iii = false;
                  console.log(iii);
  
              }
          );
  
          function loadShow(testt, id)
          {
              $.post(
                  "/admin/order/show?id=" + id + '"', function(data)
                  {
  
                      $('#content_' + id).html(data);
  
                      $('#add_mod').submit(
                          function()
                          {
                              $.ajax(
                                  {
                                      type : "POST",
                                      url : "/admin/order/add?order_id=" + id,
                                      data : $(this).serialize(), // serializes the form's elements.
                                      success : function(data)
                                      {
                                          loadShow(testt, id); // show response from the php script.
                                      }
                                  }
                              );
                              return false;
                          }
                      );
  
                  }
              );
  
          }
  
      }
  );