summaryrefslogtreecommitdiff
path: root/js/bulk_code_ajax.js
diff options
context:
space:
mode:
authorprashant2015-03-27 17:11:47 +0530
committerprashant2015-03-27 17:11:47 +0530
commitd10fad1f6d495c4039b6ea3c9b130f1ba1fd3a1b (patch)
treeb44034d47ebbec5d4211febab482004789051fa4 /js/bulk_code_ajax.js
downloaddwsim_bulk_code-d10fad1f6d495c4039b6ea3c9b130f1ba1fd3a1b.tar.gz
dwsim_bulk_code-d10fad1f6d495c4039b6ea3c9b130f1ba1fd3a1b.tar.bz2
dwsim_bulk_code-d10fad1f6d495c4039b6ea3c9b130f1ba1fd3a1b.zip
initial commit
Diffstat (limited to 'js/bulk_code_ajax.js')
-rwxr-xr-xjs/bulk_code_ajax.js91
1 files changed, 91 insertions, 0 deletions
diff --git a/js/bulk_code_ajax.js b/js/bulk_code_ajax.js
new file mode 100755
index 0000000..76d682b
--- /dev/null
+++ b/js/bulk_code_ajax.js
@@ -0,0 +1,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;
+});
+/*****############################******/
+
+
+
+});/***********************************/
+
+
+
+