Fix submit bug.
This commit is contained in:
parent
43daaa49e7
commit
58816d6097
@ -1,16 +1,14 @@
|
|||||||
jQuery( document ).ready( function ( $ ) {
|
jQuery( document ).ready( function ( $ ) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
|
||||||
var toggleSubmit = function ( _this ) {
|
var toggleSubmit = function ( _this ) {
|
||||||
if( $( _this ).attr('disabled') == "disabled" ){
|
if ( $( _this ).attr( 'disabled' ) == 'disabled' ) {
|
||||||
$( _this ).removeAttr( 'disabled' );
|
$( _this ).removeAttr( 'disabled' );
|
||||||
$( _this ).find( 'i' ).remove();
|
$( _this ).find( 'i' ).remove();
|
||||||
} else {
|
} else {
|
||||||
$( _this ).attr( 'disabled', 'disabled' );
|
$( _this ).attr( 'disabled', 'disabled' );
|
||||||
$( _this ).append( '<i class="fa fa-spinner fa-spin"></i>' );
|
$( _this ).append( '<i class="fa fa-spinner fa-spin"></i>' );
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
$( '.opalestate-submission-tab' ).each( function () {
|
$( '.opalestate-submission-tab' ).each( function () {
|
||||||
@ -44,17 +42,14 @@ jQuery( document ).ready( function ( $ ) {
|
|||||||
});
|
});
|
||||||
*/
|
*/
|
||||||
var submitFormFiles = function ( name, files ) {
|
var submitFormFiles = function ( name, files ) {
|
||||||
|
|
||||||
var formData = new FormData();
|
var formData = new FormData();
|
||||||
|
|
||||||
formData.append( 'section', 'general' );
|
formData.append( 'section', 'general' );
|
||||||
// formData.append('action', 'opalestate_submitted_property');
|
// formData.append('action', 'opalestate_submitted_property');
|
||||||
|
|
||||||
|
$( '.cmb2-uploader-files' ).each( function () {
|
||||||
$(".cmb2-uploader-files").each( function(){
|
|
||||||
var file_btn = $( 'input.select-file', this );
|
var file_btn = $( 'input.select-file', this );
|
||||||
|
|
||||||
var files = $(".uploader-item-preview", this );
|
var files = $( '.uploader-item-preview', this );
|
||||||
|
|
||||||
var name = $( this ).data( 'name' );
|
var name = $( this ).data( 'name' );
|
||||||
var issingle = $( this ).data( 'single' );
|
var issingle = $( this ).data( 'single' );
|
||||||
@ -64,14 +59,12 @@ jQuery( document ).ready( function ( $ ) {
|
|||||||
if ( issingle ) {
|
if ( issingle ) {
|
||||||
formData.append( name, file );
|
formData.append( name, file );
|
||||||
} else {
|
} else {
|
||||||
formData.append( name+"["+i+"]", file );
|
formData.append( name + '[' + i + ']', file );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
// console.log( formData );
|
|
||||||
|
|
||||||
var dataSubmit = $submit_btn.parents( 'form' ).serializeArray();
|
var dataSubmit = $submit_btn.parents( 'form' ).serializeArray();
|
||||||
|
|
||||||
$.each( dataSubmit, function ( key, input ) {
|
$.each( dataSubmit, function ( key, input ) {
|
||||||
@ -86,7 +79,7 @@ jQuery( document ).ready( function ( $ ) {
|
|||||||
type: 'POST',
|
type: 'POST',
|
||||||
processData: false,
|
processData: false,
|
||||||
contentType: false,
|
contentType: false,
|
||||||
dataType: "json",
|
dataType: 'json',
|
||||||
success: function ( response ) {
|
success: function ( response ) {
|
||||||
if ( response.status == true ) {
|
if ( response.status == true ) {
|
||||||
if ( response.redirect ) {
|
if ( response.redirect ) {
|
||||||
@ -114,14 +107,13 @@ jQuery( document ).ready( function ( $ ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
}
|
};
|
||||||
|
|
||||||
$submit_btn.parents( 'form' ).on( 'submit', function () {
|
$submit_btn.parents( 'form' ).on( 'submit', function () {
|
||||||
submitFormFiles();
|
submitFormFiles();
|
||||||
return false;
|
return false;
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
|
||||||
// Clicking Next button
|
// Clicking Next button
|
||||||
$next_btn.on( 'click', function ( e ) {
|
$next_btn.on( 'click', function ( e ) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@ -184,7 +176,8 @@ jQuery( document ).ready( function ( $ ) {
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var $el = $( this );
|
var $el = $( this );
|
||||||
var $prev_tab_item = $el.prev();
|
var $prev_tab_item = $el.prev();
|
||||||
if ( $el.hasClass( 'validated' ) || ($prev_tab_item.length != 0 && $prev_tab_item.hasClass( 'validated' ) &&
|
if ( $el.hasClass( 'validated' ) ||
|
||||||
|
( $prev_tab_item.length != 0 && $prev_tab_item.hasClass( 'validated' ) &&
|
||||||
$prev_tab_item.hasClass( 'passed' ) ) ) {
|
$prev_tab_item.hasClass( 'passed' ) ) ) {
|
||||||
$submission_tab.find( '.opalestate-tab-content' ).removeClass( 'active' );
|
$submission_tab.find( '.opalestate-tab-content' ).removeClass( 'active' );
|
||||||
$submission_tab.find( '.tab-item.active' ).removeClass( 'active' );
|
$submission_tab.find( '.tab-item.active' ).removeClass( 'active' );
|
||||||
|
@ -92,9 +92,8 @@ class Opalestate_Emails {
|
|||||||
$mail->set_pros( $post_id, $user_id );
|
$mail->set_pros( $post_id, $user_id );
|
||||||
$return = self::send_mail_now( $mail );
|
$return = self::send_mail_now( $mail );
|
||||||
|
|
||||||
echo json_encode( $return );
|
// echo json_encode( $return );
|
||||||
die();
|
// die();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user