How to send entire form data in jQuery Ajax

In jQuery Ajax, you can post the data separately. But when you needs to send the entire form data, it is very difficult to get all the form data individually and put together in data settings of Ajax. The jQuery .serialize() method makes this process easier. This method encodes a set of form elements as a string and you can put it into the data settings of Ajax.

In the following script, we’ve set entire signup form data into data settings of Ajax for submission to signup.php file. Also, an extra parameter would be sent along with the from data.

$.ajax({
    type:'POST',
    url:'signup.php',
    data:$('#signupForm').serialize()+'&signup_submit=1',
    success:function(msg){ 
    }
});

2 Comments

  1. Mike Njagi Said...
  2. Praveen Kumar Said...

Leave a reply

keyboard_double_arrow_up