None of that code is needed for the infusionsoft form to actually work and submit. It looks like the person who wrote that code is doing lots of other things that do not have anything to do with infusionsoft.
You could technically delete all of it any the form would work just fine. Here is a sample form so you can see what an infusionsoft webform looks like:
<form accept-charset="UTF-8" action="https://appname.infusionsoft.com/app/form/process/2f7236cb361ea9a84669eb9446ed7d6b" class="infusion-form" method="POST">
<input name="inf_form_xid" type="hidden" value="2f7236cb361ea9a84669eb9446ed7d6b" />
<input name="inf_form_name" type="hidden" value="Name of Form" />
<input name="infusionsoft_version" type="hidden" value="1.29.6.32" />
<div class="infusion-field">
<label for="inf_field_FirstName">First Name *</label>
<input class="infusion-field-input-container" id="inf_field_FirstName" name="inf_field_FirstName" type="text" />
</div>
<div class="infusion-field">
<label for="inf_field_LastName">Last Name *</label>
<input class="infusion-field-input-container" id="inf_field_LastName" name="inf_field_LastName" type="text" />
</div>
<div class="infusion-field">
<label for="inf_field_Email">Email *</label>
<input class="infusion-field-input-container" id="inf_field_Email" name="inf_field_Email" type="text" />
</div>
<div class="infusion-field">
<span class="infusion-option">
<input id="inf_option_Signmeupforthenewsletter" name="inf_option_Signmeupforthenewsletter" type="checkbox" value="455" />
<label for="inf_option_Signmeupforthenewsletter">Sign me up for the newsletter</label>
</span>
</div>
<div class="infusion-submit">
<input type="submit" value="Submit" />
</div>
</form>
I do not suggest you delete the other code however. It is just unrelated to the infusionsoft form itself and its ability to submit.