Verwenden Sie die JS -Variable in Form von Formularaktionen
<script> var url = foo(); </script>
<form method="POST" action=""+url enctype="multipart/form-data">
NachooCh
<script> var url = foo(); </script>
<form method="POST" action=""+url enctype="multipart/form-data">