jQuery( document ).ready( function( $ ) {

	// SUBSCRIPTION E-MAIL
	$( '.js-send-email-subscription-price-changed' ).on( 'click', function() {
		$this = $( this );

		$this.text( 'Sending...' );

		$.ajax({
			type: 'POST',
			url: wpj_vars.ajaxurl,
			data: {
				action: 'subscription_price_update_notification_action',
				price : $( this ).parents( '.description' ).siblings( 'input' ).val(),
				level : $( this ).attr( 'data-level' ),
				period: $( this ).attr( 'data-period' )
			},
			success: function( msg ) {
				$this.text( 'Sent' );

				setTimeout( function() { $this.text( 'Send email' ); }, 2000 );
			}
		});
	});

});