Quantcast
Channel: web-manual.net » jQuery
Viewing all articles
Browse latest Browse all 2

Submit form using ajax method

$
0
0

It is good idea to Submit form using Ajax technology. Asynchronous request saves time and enhance user experience. A massive usages of Ajax can be seen on Google Products. I am using jquery to submit form using Ajax. The following code snippet let you submit a form asynchronously. It uses jQuery.

submit form using ajax
Check the demo for Submit form using Ajax


The concept is very simple. Ajax request will be triggered when user click any button or link with id quicksubmit. We are using a submit input type field with id quicksubmit. Note that the dataString variable is initialized with all the variables. We are initializing variables using form field id. Last three lines of code is actually for clearing the input fields. you can enhance the code by putting some type of captcha code and few more validations such as email. Here is the HTML snippet for submitting form using ajax.

Name Email Message

Note that in the above HTML code the submit button is given an id =”quicksubmit”. The Ajax request will be called upon clicking submit button. However you can use a class as well. In case of class you need to modify the jQuery snippet a bit. you need to change #quicksubmit to .quicksubmit. In jQuery # denotes an ID whereas .(dot) denotes a class. You can download the code for Submit form using ajax here.

Hope you will enjoy the “Form Submission using jQuery Ajax”.

The post Submit form using ajax method appeared first on web-manual.net.


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles



Latest Images