how does one go about using a function as a URL in an Ajax form submission? In PHP I have a form wherein I use a function as the action

<form action="<?php echo insert()" method="POST" id="addmail">
which works well. However, the form is submitted via Ajax and I need a method in which to use the same function above in the Ajax URL

		type: "POST",
        url: "insert()", <------
        data: data,
do I have to use routing for this? I started out trying to use a class with a method within it to run this form. It became painfully obvious that I could not do that with straight PHP. I have a page in which I'm going to have several forms and I did not want to have to write a separate PHP script (php file) for each form, I really wanted to put them in a functions page.

Thank you for your consideration