$(document).ready(function(){$('#pageForm, #sideForm, #modalForm, #promoForm').submit(function(e){e.preventDefault();var form=$(this);var data=new FormData();var fields=[];form.find('input, textarea, select').each(function(){if($(this).attr('name')=='security'){data.append('security',$(this).val())}else if($(this).attr('type')=='file'){var f_name=$(this).attr('name');$.each($(this)[0].files,function(key,value){data.append(f_name,value)})}else{var input_data={};input_data.name=$(this).attr('name');input_data.value=$(this).val();if(typeof $(this).attr('data-title')!='undefined'){input_data.label=$(this).data('title')}else{input_data.label=$(this).attr('placeholder')} fields.push(input_data)}});data.append('fields',JSON.stringify(fields));data.append('action','process_request');$.ajax({url:process_request_object.ajaxurl,type:'post',data:data,processData:!1,contentType:!1,beforeSend:function(){form.find('[type="submit"]').attr('disabled','')},success:function(res){form.find('[type="submit"]').removeAttr('disabled');if(res=='OK'){location=process_request_object.redirecturl} console.log(res)}})})})