jQuery( document ).ready( function() {

	jQuery( '.carrier-rates-list-btn' ).click( function() {
		var formData    = jQuery( this ).parent().parent().find( '.elex-multi-vendor-for-woocommerce-shipping-carrier-list' ).serialize();
		var store_id    = jQuery( this ).data( 'store-id' );
		var method_slug = jQuery( this ).data( 'method-slug' );

		var data = {
			store_id:   store_id,
			action:     method_slug + '_save_carriers_for_rate',
			form:       formData,
		};

		jQuery.ajax( {
			url: elex_mv_coupon_ajaxurl_object.ajax_url,
			method: 'POST',
			data: data,
			success: function() {
				jQuery( '.toast_message_mv' ).html( 'Updated Succesfully' );
				var update = document.getElementById( 'wsdesk_update_toast' );
				var toast = new bootstrap.Toast( update );
				toast.show();
			},
		} );
	} );

} );
