$(document).ready(function () { var reRoute = $('body').attr('data-reroute'); if (reRoute == null) { reRoute = ''; } $('#signup_form').ajaxForm({ target: null, beforeSubmit: function (data) {}, success: function (result) { if (result['success'] == 1) { $('#signup_form').clearForm(); $('#signup_form').after('
Email submitted successfully.
'); $('ul.subscribe_errors').remove(); } else { $('.subscribe_errors').remove(); $('#signup_form').after('
'); var i = 0; for (i in result['errors']) { $('ul.subscribe_errors').append('
  • ' + result['errors'][i] + '
  • '); } } }, failure: function () {}, url: reRoute + '/ajax/subscribeto/index.php', type: 'POST', dataType: 'json', clearForm: false, resetForm: false }); });