Blame view

backend/web/js/site.js 1.04 KB
4253cbec   root   first commit
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
  $(document).ready(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/orders/show?id=" + id + '"', function( data ) {
  
  			$('#content_'+id).html(data);
  
  			$('#add_mod').submit(function() {
  				$.ajax({
  					type: "POST",
  					url: "/admin/orders/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;
  			});
  
  		});
  
  	}
  
  
  
  
  
  });