1var AjaxForm = { 2 3 initialize: function(afConfig) { 4 if(!jQuery().ajaxForm) { 5 document.write('<script src="'+afConfig.assetsUrl+'js/lib/jquery.form.min.js"><\/script>'); 6 } 7 8 $(document).on('submit', afConfig.formSelector, function(e) { 9 $(this).ajaxSubmit({ 10 dataType: 'json' 11 ,data: {pageId: afConfig.pageId} 12 ,url: afConfig.actionUrl 13 ,beforeSerialize: function(form, options) { 14 form.find(':submit').each(function() { 15 if (!form.find('input[type="hidden"][name="' + $(this).attr('name') + '"]').length) { 16 $(form).append( 17 $('<input type="hidden">').attr({ 18 name: $(this).attr('name'), 19 value: $(this).attr('value') 20 }) 21 ); 22 } 23 }) 24 } 25 ,beforeSubmit: function(fields, form) { 26 if (typeof(afValidated) != 'undefined' && afValidated == false) { 27 return false; 28 } 29 form.find('.error').html(''); 30 form.find('.error').removeClass('error'); 31 form.find('input,textarea,select,button').attr('disabled', true); 32 return true; 33 } 34 ,success: function(response, status, xhr, form) { 35 form.find('input,textarea,select,button').attr('disabled', false); 36 response.form=form; 37 $(document).trigger('af_complete', response); 38 if (!response.success) { 39 if (response.data) { 40 var key, value; 41 for (key in response.data) { 42 if (response.data.hasOwnProperty(key)) { 43 value = response.data[key]; 44 form.find('.error_' + key).html(value).addClass('error'); 45 form.find('[name="' + key + '"]').addClass('error'); 46 } 47 } 48 } 49 } 50 else { 51 form.find('.error').removeClass('error'); 52 form[0].reset(); 53 jQuery(form[0]).html(response.message); 54 // console.log(form[0]); 55 } 56 } 57 }); 58 e.preventDefault(); 59 return false; 60 }); 61 62 $(document).on('reset', afConfig.formSelector, function(e) { 63 $(this).find('.error').html(''); 64 }); 65 } 66 67};
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.