DO YOU NEED A CONTENT WRITER FOR YOUR BUSINESS?

Your One-Stop Solution for All Content Needs! Click here for more!
Categories: jQuery

jQuery serialize() function

Share

jQuery serialize() method creates a URL encoded text string by serializing the form values.

This values can be used in query string for making an AJAX request.

jQuery serialize() can act on a jQuery object for selecting individual form controls like <input>, <textarea>, and <select> etc.

Example of serialize:

Suppose, you have a following HTML:

<form action-xhr="#">
Name: <input type="text" name="name" value="John"><br>
Age: <input type="text" name="age" value="30"><br>
<input type="submit" name="submit" value="Submit" />
</form>

When using serialize() method as below:

var str = $( "form" ).serialize();
console.log( str );

Results: name=John&age=30

Jacob Frazier

Based on United States, Jacob Frazier is a skilled JavaScript developer with over 8 years of experience. He is passionate about change and trying new things, both professionally and personally. He loves startups and is extremely proactive.

Recent Posts

Are We All Addicted to Stimulation? The New Face of Anxiety Disorders

Does your phone control your mind more than you control your phone? Modern life exploits…

1 day ago

What Lifestyle Changes Help Prevent BPH from Coming Back

Did you know that the prostate continues growing throughout a man's entire life, making BPH…

1 day ago

Sleep Apnea in Children: Could Enlarged Adenoids Be the Cause?

Could your child's snoring be more than just a noisy night? When adenoids—the lymphoid tissue…

1 day ago

Fitting Electric Strike Sensors Safely

There are a number of steps that need to be taken in order to fit…

2 days ago

The Future of Cryptocurrency 100 Years From Now: Bold Predictions & Key Forces

Cryptocurrency has transformed from a digital experiment into a global financial force in just over…

4 days ago

Silent Layoffs in Indian Tech Sector: Subtle Signs Employees Shouldn’t Ignore

Introduction Layoffs have always been a part of corporate life, but the way they’re happening…

5 days ago