Ajax form as block and php file
Permalink
Hello I created a block ajax form
my view.php is
My ajax
The problem is:
http://mywebsite.com/index.php/page(whatever)/test.php... (Not Found)
because is in the block what to do???
my view.php is
<form id="form_test" action="form.php" enctype="multipart/form-data" method="post"> ..... </form>
My ajax
function submitForm(formData) { $.ajax({ 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???
I made it a little bit easier for me. I moved the php file in another folder wrote an if statement
if(form1){
if (mail($mail, "email subject", $message)) {
echo '1';
} else {
echo '0';
}
}
if(form2)
if (mail($mail2, "email subject", $message)) {
echo '1';
} else {
echo '0';
}
So I use one form.php for all 5 different Ajax forms
if(form1){
if (mail($mail, "email subject", $message)) {
echo '1';
} else {
echo '0';
}
}
if(form2)
if (mail($mail2, "email subject", $message)) {
echo '1';
} else {
echo '0';
}
So I use one form.php for all 5 different Ajax forms
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.
http://www.concrete5.org/community/forums/customizing_c5/ajax-into-...