Ajax form as block and php file

Hello I created a block ajax form
my view.php is
<form id="form_test" action="form.php" enctype="multipart/form-data" method="post"> ..... </form>

My ajax
function submitForm(formData) {
      type: 'POST',
      url: 'form.php',      
      ..... etc.....

The problem is:
http://mywebsite.com/index.php/page(whatever)/test.php... (Not Found)
because is in the block what to do???

View Replies:
JohntheFish replied on at Permalink Reply
The target for ajax calls within c5 should usually be set up as a tool or an action in the associated page controller. c5 includes helpers that generate the correct action paths.

The reason is that to answer an ajax call c5 does not want to render a full page, so needs to provide an entrance to the ajax responder withou rendering a page.

You may find the links in this post from yesterday helpful.
sergio11ofpp replied on at Permalink Reply
I made it a little bit easier for me. I moved the php file in another folder wrote an if statement
if (mail($mail, "email subject", $message)) {
echo '1';
} else {
echo '0';

if (mail($mail2, "email subject", $message)) {
echo '1';
} else {
echo '0';

So I use one form.php for all 5 different Ajax forms