Download Ajax form submit

Demo

Bookmark and Share

Download files

You can download the entire script from this Zip file.

Files included in package

  • form-submit.html = Main HTML file
  • js/form-submit.js = Main JS file
  • js/ajax.js = Ajax (Library from http://twilightuniverse.com/projects/sack)
  • form-submit.php = PHP file which parses submtted data and outputs them back to the screen.

Configuration

This is a standalone version of the form submit class available in the DHTML Suite. The DHTMLSuite.form class is used to send a form to the server via Ajax. This is an example of the Javascript code used to create a form object:

var formObj = new DHTMLSuite.form({
formRef:'myForm',
action:'includes/formSubmit.php',
responseEl:'formResponse'}
);

As you can see, properties are sent to the constructor in an associative array:

  • formRef - Reference to the form. It could be a direct reference or the name or id of the form.
  • method - How to post the form - Optional, default = "POST".
  • action - Relative path to the file where the form will be submitted.
  • responseEl - Reference to HTML element where response from the server will be inserted. It could be a direct reference or the id of the element
  • responseFile - Path to alternative response file. When defined, the content of this file will be inserted into responseEl, i.e. instead of the response from the "action" file.
  • callbackOnComplete - Name of callback function to execute when the form has been submitted. This function will receive the name of the form as only argument.

The method "submit" is used to submit the form. Example:

<INPUT type="button" value="Send" onclick="formObj.submit()">

File uploads

When the form contains one or more form elements, the form will be submitted to a dynamically created and hidden iframe. When the form is finished submitted, the content of this iframe will be inserted into the element defined as responseEl.

Comments

ckj
good aricle
ckj at 01:21PM, 2011/04/07.
dr4t
what do i have to change in the downloaded code so that it will load the action page in a certain div?
thank you!
dr4t at 10:44PM, 2011/04/17.
Doki
Nice work:)
Doki at 04:19AM, 2011/05/19.
Sujan Patnana
I used the code in my application.It worked perfectly in firefox but when i am using cromei couldnot get expected out put. can u plz help
Sujan Patnana at 06:24AM, 2011/11/11.
Bogdan Gusiev
Try https://github.com/bogdan/ajaxsubmit library. It does ajax submition as well as validation via ajax.Also configuration is very flexible to support any kind of UI.Live demo available with js, css and html examples:http://ajaxsubmit.heroku.com
Bogdan Gusiev at 01:01PM, 2012/03/23.
Luke
Could this be modified into a script to add comments to a gallery? If not would anyone consider making one?
Luke at 11:04AM, 2012/05/15.
Calvinfoo
ASP problem
When I tried ot submit to an ASP page, the asp page somehow captured double information for the checkboxes.

In your Demo, it shows in PHP, which is correct:
hobbies[0]: games
hobbies[1]: soccer
hobbies[2]: stamps

but when I submit it to an ASP Page, it shows double entry for Checkboxes. Others (text, radio, etc) are working fine.

hobbies[0] : games, games
hobbies[1] : soccer, soccer
hobbies[2] : stamps, stamps



Please advise
Calvinfoo at 08:03AM, 2012/05/22.
Calvinfoo
nvm, solved, not sure what went wrong.
Calvinfoo at 08:17AM, 2012/05/22.
Calvinfoo
input type=Button does not pass the value over. :(
Calvinfoo at 03:26AM, 2012/05/24.
WilliamlayemN
Hello.
I need to contact admin.
Thank you.
WilliamlayemN at 01:17PM, 2017/02/12.
DarrellTug
Until Аugust 11, 999 аmazоn egift саrds with a face valuе оf $ 2,000 аrе being рlаyed. This is the bеst lottеrу in whiсh уou hаve еver раrticiраtеd. Tiсkets vеry quicklу buy uр, hurrу: http://www.daromvse.com/go?https://www.pinterest.com/pin/690387817853257539/
DarrellTug at 07:46AM, 2018/07/21.
Scottunfam
Hellо! I'll tell you mу method with аll the dеtаils, as I startеd eаrning in thе Internеt from $ 3,500 реr dаy with the hеlp of soсiаl netwоrks reddit and twitter. In this video you will find mоrе dеtаilеd infоrmation and аlso see hоw mаny milliоns have earned those whо hаvе bееn working fоr a уear using mу mеthod. I sресificаlly made a vidеo in this сарасitу. After buуing mу mеthоd, уou will understаnd whу: http://www.maxmailing.be/tl.php?p=32x/rs/rs/rv/sd/rt//https://vk.cc/8jfmUx
Scottunfam at 03:42PM, 2018/07/25.
Scottunfam
Hellо! I'll tell you mу method with аll the dеtаils, as I startеd eаrning in thе Internеt from $ 3,500 реr dаy with the hеlp of soсiаl netwоrks reddit and twitter. In this video you will find mоrе dеtаilеd infоrmation and аlso see hоw mаny milliоns have earned those whо hаvе bееn working fоr a уear using mу mеthod. I sресificаlly made a vidеo in this сарасitу. After buуing mу mеthоd, уou will understаnd whу: http://www.maxmailing.be/tl.php?p=32x/rs/rs/rv/sd/rt//https://vk.cc/8jfmUx
Scottunfam at 03:42PM, 2018/07/25.
Scottunfam
Hellо! I'll tell you mу method with аll the dеtаils, as I startеd eаrning in thе Internеt from $ 3,500 реr dаy with the hеlp of soсiаl netwоrks reddit and twitter. In this video you will find mоrе dеtаilеd infоrmation and аlso see hоw mаny milliоns have earned those whо hаvе bееn working fоr a уear using mу mеthod. I sресificаlly made a vidеo in this сарасitу. After buуing mу mеthоd, уou will understаnd whу: http://www.maxmailing.be/tl.php?p=32x/rs/rs/rv/sd/rt//https://vk.cc/8jfmUx
Scottunfam at 03:42PM, 2018/07/25.
Scottunfam
Hellо! I'll tell you mу method with аll the dеtаils, as I startеd eаrning in thе Internеt from $ 3,500 реr dаy with the hеlp of soсiаl netwоrks reddit and twitter. In this video you will find mоrе dеtаilеd infоrmation and аlso see hоw mаny milliоns have earned those whо hаvе bееn working fоr a уear using mу mеthod. I sресificаlly made a vidеo in this сарасitу. After buуing mу mеthоd, уou will understаnd whу: http://www.maxmailing.be/tl.php?p=32x/rs/rs/rv/sd/rt//https://vk.cc/8jfmUx
Scottunfam at 03:42PM, 2018/07/25.
Jelle
Hi, It's not working with php 7, it works with php 5.

The output is the php file, instead of the POST data or Get data.

My output:

Ajax form submit
Form posted with Ajax"; echo "
POST variables
"; foreach($_POST as $key=>$value){ if(is_array($value)){ for($no=0;$no".$key."[$no]: ".$value[$no]."
"; } }else{ echo "".$key.": ".$value."
"; } } echo "
GET variables:
"; foreach($_GET as $key=>$value){ if(is_array($value)){ for($no=0;$no".$key."[$no]: ".$value[$no]."
"; } }else{ echo "".$key.": ".$value."
"; } } ?>

Help please
Jelle at 10:03PM, 2018/07/27.
JamesTox
Help Jack please: http://www.url2it.com/iaeedh
JamesTox at 03:48PM, 2018/08/04.
Albertnig
What do you think about it?
This person is selling the secret of eternal youth:
http://makemoneyonline201834447.educationalimpactblog.com/1790383/about-about-anti-aging-products
https://www.pinterest.com/pin/794815034212879929
https://www.pinterest.com/pin/843721311416220833
https://www.pinterest.com/pin/590816044842500469
https://www.pinterest.com/pin/631911391441402290
https://www.pinterest.com/pin/775463629563962974
https://www.pinterest.com/pin/631911391441403420
Albertnig at 02:03AM, 2018/08/10.
Peterspome
What do you think about it?
This person is selling the secret of eternal youth:
https://www.pinterest.com/pin/825073594209244141
https://www.pinterest.com/pin/775463629563962552
https://www.pinterest.com/pin/825073594209245300
https://www.pinterest.com/pin/677721443901267707
https://www.pinterest.com/pin/748442031799729044
https://www.pinterest.com/pin/785807834958017609
https://www.pinterest.com/pin/644155552928877067
Peterspome at 02:04AM, 2018/08/10.

Post your comment

Don't have an avatar? Create one at Gravatar.com.

Confirmation code:

Go to cbolson.com


About/Contact | A good idea? | Submit a script | Privacy notice
© 2005 - 2024 dhtmlgoodies.com