1jQuery(function ($) { 2 $(document).on('submit', '.rentec-blog-subscribe-form', function (e) { 3 e.preventDefault(); 4 5 const $form = $(this); 6 const $message = $form.find('.rentec-blog-subscribe-message'); 7 const $button = $form.find('.rentec-blog-subscribe-button'); 8 const $email = $form.find('input[name="email"]'); 9 const email = ($email.val() || '').trim(); 10 const defaultText = $button.data('default-text') || RentecBlogSubscribe.buttonTextDefault; 11 12 $message.text('').removeClass('success error'); 13 14 if (!email) { 15 $message.text('Please enter your email address.').addClass('error'); 16 return; 17 } 18 19 $button.prop('disabled', true).text(RentecBlogSubscribe.buttonTextLoading); 20 21 $.ajax({ 22 url: RentecBlogSubscribe.ajaxUrl, 23 type: 'POST', 24 dataType: 'json', 25 data: { 26 action: 'rentec_blog_subscribe', 27 nonce: RentecBlogSubscribe.nonce, 28 email: email 29 } 30 }) 31 .done(function (response) { 32 if (response && response.success) { 33 $message 34 .text(response.data && response.data.message ? response.data.message : 'Thanks for subscribing.') 35 .addClass('success'); 36 $form[0].reset(); 37 } else { 38 $message 39 .text(response && response.data && response.data.message ? response.data.message : 'Unable to subscribe.') 40 .addClass('error'); 41 } 42 }) 43 .fail(function () { 44 $message 45 .text(RentecBlogSubscribe.unexpectedError) 46 .addClass('error'); 47 }) 48 .always(function () { 49 $button.prop('disabled', false).text(defaultText); 50 }); 51 }); 52});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.