Download Ajax form submit


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
  • form-submit.php = PHP file which parses submtted data and outputs them back to the screen.


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({

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.


good aricle
ckj at 01:21PM, 2011/04/07.
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.
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 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:
Bogdan Gusiev at 01:01PM, 2012/03/23.
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.
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.
nvm, solved, not sure what went wrong.
Calvinfoo at 08:17AM, 2012/05/22.
input type=Button does not pass the value over. :(
Calvinfoo at 03:26AM, 2012/05/24.
I need to contact admin.
Thank you.
WilliamlayemN at 01:17PM, 2017/02/12.
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у:
DarrellTug at 07:46AM, 2018/07/21.

Post your comment

Don't have an avatar? Create one at

Confirmation code:

Go to

About/Contact | A good idea? | Submit a script | Privacy notice
© 2005 - 2018