Just remove the "event.preventDefault()" line. Your function will be executed before the submit takes place, and you want the submission to happen anyway, so it's unnecessary.
Why didn't the trigger work?
I think it's because you were trying to access an element that no longer existed. You looped through each <input> element and added an underscore and that element's classes to its name. And your submit button is an <input> element, so even if it didn't have any classes, its name was still changed to "csvsubmit_".