Send HTML Form Data as JSON via Ajax

Send HTML Form Data as JSON via Ajax

Today, We want to share with you Send HTML Form Data as JSON via Ajax.In this post we will show you form submit json without ajax, hear for save html form data to json file we will give you demo and example for implement.In this post, we will learn about how to convert html form field values to a json object with an example.

List of all Google Adsense, VueJS, AngularJS, PHP, Laravel Examples.

Snippet Contents

Send HTML Form Data as JSON via Ajax

There are the Following The simple About Send HTML Form Data as JSON via Ajax Full Information With Example and source code.

As I will cover this Post with live Working example to develop html form to json object, so the html form to json object for this example is following below.

save html form data to json file


var userData = {};
 var formData = $("#myform").serializeArray();
	 $.each(formData, function() {
	 if (userData[]) {
	 if (!userData[].push) {
		userData[] = [userData[]];
		userData[].push(this.value || '');
	 } else {
		userData[] = this.value || '';


<!DOCTYPE html>
<html lang="en">
<script src=""></script>
<script src="jquery.serializeJSON.min.js"></script>
var ProductForm = $("#live_frmData").serializeJSON();
 url : "do_submit.php",
 type: "POST",
 data : {valArray:ProductForm},


 error: function(jqXHR, textStatus, errorThrown)
 e.preventDefault(); //STOP default action

<div id="message"> </div>
<form name="live_frmData" id="live_frmData" method="POST">
User First Name: <input type="text" name="usename" value =""/> <br/>
User Last Name: <input type="text" name="lastname" value ="" /> <br/>
Email : <input type="text" name="email" value=""/> <br/>
<input type="button" class="btn btn-info" id="saveUser" value="Save User"></form>

Web Programming Tutorials Example with Demo

Read :


You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Send HTML Form Data as JSON via Ajax.
I would like to have feedback on my blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Related FAQ

Here are some more FAQ related to this Article:

  1.   Load More Data from Database using vue.js Ajax PHP
  2.   Vue js Toggle switch Update DB field using Ajax
  3.   Angular 9/8 Material Input Box Examples
  4.   JavaScript setInterval and clearInterval function
  5.   PHP Auto image resizing Script
  6.   Retrieve last insert id by Eloquent in Laravel 6
  7.   Vue js Multiple Tag Input with Dynamic Autocomplete
  8.   Simple Tooltip Component with CSS and Vuejs
  9.   Laravel Installer Create Web Application install scripts
  10.   PHP sleep delay Function increasing execution time