Advertisement
Guest User

File Upload AJAX

a guest
Sep 4th, 2015
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. jQuery(function($){
  2.  
  3.    $(document).bind('gform_post_render', function(event, form_id){
  4.        
  5.     if (form_id == 1) {
  6.         var uploader = $("#gform_drag_drop_area_1_1");
  7.         var uploads = $("#gform_uploaded_files_1").val();
  8.          
  9.         uploader.on("drop", function() {  
  10.            
  11.         $.ajax({
  12.         url: mp3_object.ajaxurl,
  13.         async: true,
  14.             type: "POST",
  15.             data: {
  16.         action : 'ajax_mp3',
  17.         files : uploads,
  18.             },
  19.            
  20.             success: function(response) {
  21.                 alert(response);
  22.             }
  23.             });
  24.    
  25.         });
  26.        
  27.        
  28.         }
  29.     });
  30. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement