summaryrefslogtreecommitdiff
path: root/js/bulk_code_ajax.js
blob: 76d682b8eed1f67dde8262c58b1d3e75b72799dd (plain)
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
$(document).ready(function(e){

    var basePath = Drupal.settings.basePath;
    var modPath = basePath + "bulk_code/";
    var modPath1 = basePath + "bulk_code/books/";
    var modPath2 = basePath + "bulk_code/books/all";
    var modPath3 = basePath + "bulk_code/forms/";
    var modPath4 = basePath + "comments/rand/";

$('#disapprove_textrea').hide();
$('.submit_form_bulk_approve').hide();

$(this).on('change', '#select_book', function(){
				var	id = $('#select_book').val();					
				var type = $('#select_book').attr('id');				
			    var dataString = 'id='+ id + '&type=' + type;
				    
if(id == 0){
$('#download_entire_book').hide();
$('#disapprove_textrea').hide();
$('.submit_form_bulk_approve').hide();
}else{	    
$.ajax({
      type: "POST",
      url: modPath + "ajax/",
      data: dataString,
      cache: false,
      success: function(result){  
       $('#download_entire_book').show();     
       $('#download_entire_book').html(result);
       $('#disapprove_textrea').show();
       $('.submit_form_bulk_approve').show();              
      }
      });
      }
					
});
/*****############################******/
$(".submit_form_bulk_approve").click(function(){
//$(this).on('submit', '.submit_form_bulk_approve', function(event) {
var pref_id = $("#select_book").val();
var action = $(".form_action:checked").val();
var dis_approve_reason = $("#dis_approve").val();

// Returns successful data submission message when the entered information is stored in database.
var dataString = 'pref_id='+ pref_id + '&action='+ action + '&dis_approve_reason='+ dis_approve_reason ;
if(pref_id==null || pref_id=='', action ==null || action == '' ){
alert('Please select action');

}
else{
// AJAX Code To Submit Form.
console.log(dataString);
var conf_action=confirm("Are  you sure?");
    if (conf_action==true)
    {
$.ajax({
       type: "POST",
       url: modPath1 + "ajax/",
       data: dataString,
       cache: false,			
       success: function(data){
           var re_load=confirm(data);
           if (re_load==true){
              window.location.reload();
           }else{
             window.location.reload();
            }
      }

});
    }
    else
    { 
    window.location.reload(); 
    return false;
    }
//location.reload();
//trigger('reset');		
}
return false;
});
/*****############################******/
	
	 

});/***********************************/