Hello, please help understand and understand the following example. I need an explanation of this code, it is advisable to comment line by line ...
$(function(){ $('#my_form').on('submit', function(e){ e.preventDefault(); var $that = $(this), fData = $that.serialize(); .... // fData = $that.serializeArray(); $.ajax({ url: $that.attr('action'), type: $that.attr('method'), data: {form_data: fData}, dataType: 'json', success: function(json){ if(json){ $that.replaceWith(json); } } }); }); });